diff --git a/api/config.go b/api/config.go index 874ca45..4b72698 100644 --- a/api/config.go +++ b/api/config.go @@ -38,12 +38,6 @@ func parseConfig() error { "GOOGLE_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) @@ -52,6 +46,12 @@ func parseConfig() 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"} { if os.Getenv(env) == "" { diff --git a/api/config_file.go b/api/config_file.go index 1797054..8303c6b 100644 --- a/api/config_file.go +++ b/api/config_file.go @@ -41,6 +41,10 @@ func configFileLoad(filepath string) error { continue } + if os.Getenv(key[9:]) != "" { + continue + } + os.Setenv(key[9:], value) }