mirror of
https://github.com/foxcpp/maddy.git
synced 2025-04-04 13:37:41 +03:00
39 lines
739 B
Go
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
|
|
}
|