summaryrefslogtreecommitdiffstats
path: root/app/config.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2018-04-09 12:16:11 -0400
committerJesús Espino <jespinog@gmail.com>2018-04-09 18:16:11 +0200
commit0a6b96cb40d9dd5acca7e366df9cd14fa4eff6a7 (patch)
tree4b46ef4dc50aed2171d3b5ec38117a148db7ae29 /app/config.go
parent57ee6f505e1b231733dc73dc25d2fbe14bd6b7d5 (diff)
downloadchat-0a6b96cb40d9dd5acca7e366df9cd14fa4eff6a7.tar.gz
chat-0a6b96cb40d9dd5acca7e366df9cd14fa4eff6a7.tar.bz2
chat-0a6b96cb40d9dd5acca7e366df9cd14fa4eff6a7.zip
MM-9849 Added tracking of which settings are set through environment variables (#8586)
* MM-9849 Added tracking of which settings are set through environment variables * Removed old version of viper * Added forked version of viper * Fixed unit tests * Fixed more unit tests * Removed copy from App.GetEnvironmentConfig
Diffstat (limited to 'app/config.go')
-rw-r--r--app/config.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/config.go b/app/config.go
index 761fe3ec9..75d38e24a 100644
--- a/app/config.go
+++ b/app/config.go
@@ -30,6 +30,13 @@ func (a *App) Config() *model.Config {
return &model.Config{}
}
+func (a *App) EnvironmentConfig() map[string]interface{} {
+ if a.envConfig != nil {
+ return a.envConfig
+ }
+ return map[string]interface{}{}
+}
+
func (a *App) UpdateConfig(f func(*model.Config)) {
old := a.Config()
updated := old.Clone()
@@ -46,7 +53,7 @@ func (a *App) PersistConfig() {
func (a *App) LoadConfig(configFile string) *model.AppError {
old := a.Config()
- cfg, configPath, err := utils.LoadConfig(configFile)
+ cfg, configPath, envConfig, err := utils.LoadConfig(configFile)
if err != nil {
return err
}
@@ -57,6 +64,7 @@ func (a *App) LoadConfig(configFile string) *model.AppError {
l4g.Info("Using config file at %s", configPath)
a.config.Store(cfg)
+ a.envConfig = envConfig
a.siteURL = strings.TrimRight(*cfg.ServiceSettings.SiteURL, "/")