Let's Encrypt
This commit is contained in:
parent
22892a4073
commit
b55cb13e44
82 changed files with 13536 additions and 107 deletions
48
storage/directory.go
Normal file
48
storage/directory.go
Normal file
|
@ -0,0 +1,48 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/khlieng/dispatch/Godeps/_workspace/src/github.com/mitchellh/go-homedir"
|
||||
)
|
||||
|
||||
var Path directory
|
||||
|
||||
func SetDirectory(dir string) {
|
||||
Path = directory(dir)
|
||||
}
|
||||
|
||||
func DefaultDirectory() string {
|
||||
home, _ := homedir.Dir()
|
||||
return filepath.Join(home, ".dispatch")
|
||||
}
|
||||
|
||||
type directory string
|
||||
|
||||
func (d directory) Root() string {
|
||||
return string(d)
|
||||
}
|
||||
|
||||
func (d directory) LetsEncrypt() string {
|
||||
return filepath.Join(d.Root(), "letsencrypt")
|
||||
}
|
||||
|
||||
func (d directory) Logs() string {
|
||||
return filepath.Join(d.Root(), "logs")
|
||||
}
|
||||
|
||||
func (d directory) Log(userID string) string {
|
||||
return filepath.Join(d.Logs(), userID+".log")
|
||||
}
|
||||
|
||||
func (d directory) Index(userID string) string {
|
||||
return filepath.Join(d.Logs(), userID+".idx")
|
||||
}
|
||||
|
||||
func (d directory) Config() string {
|
||||
return filepath.Join(d.Root(), "config.toml")
|
||||
}
|
||||
|
||||
func (d directory) Database() string {
|
||||
return filepath.Join(d.Root(), "dispatch.db")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue