Refactoring cfg refs and load / save functions (#7749)

* refactoring cfg refs and load / save functions

* improve error output
Этот коммит содержится в:
Chris
2017-10-31 09:39:31 -05:00
коммит произвёл Joram Wilander
родитель b446d0aa0a
Коммит ce2b2be5de
28 изменённых файлов: 250 добавлений и 247 удалений

Просмотреть файл

@@ -131,14 +131,6 @@ func (a *App) GetConfig() *model.Config {
return cfg
}
func (a *App) ReloadConfig() {
debug.FreeOSMemory()
utils.LoadConfig(a.ConfigFileName())
// start/restart email batching job if necessary
a.InitEmailBatching()
}
func (a *App) SaveConfig(cfg *model.Config, sendConfigChangeClusterMessage bool) *model.AppError {
oldCfg := a.Config()
cfg.SetDefaults()
@@ -157,8 +149,11 @@ func (a *App) SaveConfig(cfg *model.Config, sendConfigChangeClusterMessage bool)
}
utils.DisableConfigWatch()
utils.SaveConfig(a.ConfigFileName(), cfg)
utils.LoadConfig(a.ConfigFileName())
a.UpdateConfig(func(update *model.Config) {
*update = *cfg
})
a.PersistConfig()
a.ReloadConfig()
utils.EnableConfigWatch()
if a.Metrics != nil {