maddy/directories.go
fox.cpp 6e17ecab31 Change default file locations (#35)
* Change default files location as described in #27

* config: Change default config file name
2019-04-08 19:57:21 +03:00

39 lines
699 B
Go

package maddy
import (
"os"
)
var (
defaultConfigDirectory = "/etc/maddy"
defaultStateDirectory = "/var/lib/maddy"
defaultLibexecDirectory = "/usr/libexec/maddy"
)
func ConfigDirectory() string {
return defaultConfigDirectory
}
func StateDirectory(globals map[string]interface{}) string {
if dir := os.Getenv("MADDYSTATE"); dir != "" {
return dir
}
if val, ok := globals["statedir"]; ok {
return val.(string)
}
return defaultStateDirectory
}
func LibexecDirectory(globals map[string]interface{}) string {
if dir := os.Getenv("MADDYLIBEXEC"); dir != "" {
return dir
}
if val, ok := globals["libexecdir"]; ok {
return val.(string)
}
return defaultLibexecDirectory
}