refactor: store config path options in ConfigFilePaths

This commit is contained in:
Derrick Hammer 2023-06-09 15:35:33 -04:00
parent 0d0a46e5e1
commit da0efcdd0c
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 13 additions and 3 deletions

View File

@ -8,12 +8,22 @@ import (
"log"
)
var (
ConfigFilePaths = []string{
"/etc/lumeweb/portal/",
"$HOME/.lumeweb/portal/",
".",
}
)
func Init() {
viper.SetConfigName("config")
viper.SetConfigType("json")
viper.AddConfigPath("/etc/lumeweb/portal/")
viper.AddConfigPath("$HOME/.lumeweb/portal/")
viper.AddConfigPath(".")
for _, path := range ConfigFilePaths {
viper.AddConfigPath(path)
}
viper.SetEnvPrefix("LUME_WEB_PORTAL")
viper.AutomaticEnv()