mirror of
https://gitlab.com/commento/commento.git
synced 2025-06-29 22:56:37 -04:00
api: allow configuration files
Closes https://gitlab.com/commento/commento-ce/issues/55
This commit is contained in:
@ -14,6 +14,8 @@ func parseConfig() error {
|
||||
}
|
||||
|
||||
defaults := map[string]string{
|
||||
"CONFIG_FILE": "",
|
||||
|
||||
"POSTGRES": "postgres://postgres:postgres@localhost/commento?sslmode=disable",
|
||||
|
||||
"BIND_ADDRESS": "127.0.0.1",
|
||||
@ -36,6 +38,12 @@ 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)
|
||||
|
Reference in New Issue
Block a user