maddy/directories.go
fox.cpp 48d17cb1f2
Change default libexecdir value
Most distros use /usr/lib/programname instead of
/usr/libexec/programname.
2019-09-06 21:34:51 +03:00

39 lines
739 B
Go

package maddy
import (
"os"
)
var (
defaultConfigDirectory = "/etc/maddy"
defaultStateDirectory = "/var/lib/maddy"
defaultLibexecDirectory = "/usr/lib/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 && val.(string) != "" {
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 && val.(string) != "" {
return val.(string)
}
return defaultLibexecDirectory
}