config.go: parse config file before default
Closes https://gitlab.com/commento/commento/issues/187
This commit is contained in:
@@ -58,6 +58,12 @@ func configParse() error {
|
||||
"GITLAB_SECRET": "",
|
||||
}
|
||||
|
||||
if os.Getenv("COMMENTO_CONFIG_FILE") != "" {
|
||||
if err := configFileLoad(os.Getenv("COMMENTO_CONFIG_FILE")); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
for key, value := range defaults {
|
||||
if os.Getenv("COMMENTO_"+key) == "" {
|
||||
os.Setenv(key, value)
|
||||
@@ -66,12 +72,6 @@ func configParse() error {
|
||||
}
|
||||
}
|
||||
|
||||
if os.Getenv("CONFIG_FILE") != "" {
|
||||
if err := configFileLoad(os.Getenv("CONFIG_FILE")); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Mandatory config parameters
|
||||
for _, env := range []string{"POSTGRES", "PORT", "ORIGIN", "FORBID_NEW_OWNERS", "MAX_IDLE_PG_CONNECTIONS"} {
|
||||
if os.Getenv(env) == "" {
|
||||
|
||||
Reference in New Issue
Block a user