summaryrefslogtreecommitdiffstats
path: root/app/admin.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-10-18 15:36:43 -0700
committerGitHub <noreply@github.com>2017-10-18 15:36:43 -0700
commit8e19ba029f889519d93cf272960dce858971106c (patch)
treed8f38ac62661fb8578e2b5c3c619fe31ab29f480 /app/admin.go
parent34a87fa8f47b1447b73e3ae56866b654801b3eee (diff)
downloadchat-8e19ba029f889519d93cf272960dce858971106c.tar.gz
chat-8e19ba029f889519d93cf272960dce858971106c.tar.bz2
chat-8e19ba029f889519d93cf272960dce858971106c.zip
Reduce utils.Cfg references (#7650)
* app.UpdateConfig method * test fix * another test fix * the config override option as-was is just error prone, remove it for now * derp
Diffstat (limited to 'app/admin.go')
-rw-r--r--app/admin.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/app/admin.go b/app/admin.go
index 5994fc826..fc792a3f0 100644
--- a/app/admin.go
+++ b/app/admin.go
@@ -24,7 +24,7 @@ func (a *App) GetLogs(page, perPage int) ([]string, *model.AppError) {
perPage = 10000
var lines []string
- if a.Cluster != nil && *utils.Cfg.ClusterSettings.Enable {
+ if a.Cluster != nil && *a.Config().ClusterSettings.Enable {
lines = append(lines, "-----------------------------------------------------------------------------------------------------------")
lines = append(lines, "-----------------------------------------------------------------------------------------------------------")
lines = append(lines, a.Cluster.GetMyClusterInfo().Hostname)
@@ -39,7 +39,7 @@ func (a *App) GetLogs(page, perPage int) ([]string, *model.AppError) {
lines = append(lines, melines...)
- if a.Cluster != nil && *utils.Cfg.ClusterSettings.Enable {
+ if a.Cluster != nil && *a.Config().ClusterSettings.Enable {
clines, err := a.Cluster.GetLogs(page, perPage)
if err != nil {
return nil, err
@@ -54,8 +54,8 @@ func (a *App) GetLogs(page, perPage int) ([]string, *model.AppError) {
func (a *App) GetLogsSkipSend(page, perPage int) ([]string, *model.AppError) {
var lines []string
- if utils.Cfg.LogSettings.EnableFile {
- file, err := os.Open(utils.GetLogFileLocation(utils.Cfg.LogSettings.FileLocation))
+ if a.Config().LogSettings.EnableFile {
+ file, err := os.Open(utils.GetLogFileLocation(a.Config().LogSettings.FileLocation))
if err != nil {
return nil, model.NewAppError("getLogs", "api.admin.file_read_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -124,7 +124,7 @@ func (a *App) InvalidateAllCachesSkipSend() {
}
func (a *App) GetConfig() *model.Config {
- json := utils.Cfg.ToJson()
+ json := a.Config().ToJson()
cfg := model.ConfigFromJson(strings.NewReader(json))
cfg.Sanitize()
@@ -140,7 +140,7 @@ func (a *App) ReloadConfig() {
}
func (a *App) SaveConfig(cfg *model.Config, sendConfigChangeClusterMessage bool) *model.AppError {
- oldCfg := utils.Cfg
+ oldCfg := a.Config()
cfg.SetDefaults()
utils.Desanitize(cfg)
@@ -152,7 +152,7 @@ func (a *App) SaveConfig(cfg *model.Config, sendConfigChangeClusterMessage bool)
return err
}
- if *utils.Cfg.ClusterSettings.Enable && *utils.Cfg.ClusterSettings.ReadOnlyConfig {
+ if *a.Config().ClusterSettings.Enable && *a.Config().ClusterSettings.ReadOnlyConfig {
return model.NewAppError("saveConfig", "ent.cluster.save_config.error", nil, "", http.StatusForbidden)
}
@@ -162,7 +162,7 @@ func (a *App) SaveConfig(cfg *model.Config, sendConfigChangeClusterMessage bool)
utils.EnableConfigWatch()
if a.Metrics != nil {
- if *utils.Cfg.MetricsSettings.Enable {
+ if *a.Config().MetricsSettings.Enable {
a.Metrics.StartServer()
} else {
a.Metrics.StopServer()
@@ -205,10 +205,10 @@ func (a *App) TestEmail(userId string, cfg *model.Config) *model.AppError {
// if the user hasn't changed their email settings, fill in the actual SMTP password so that
// the user can verify an existing SMTP connection
if cfg.EmailSettings.SMTPPassword == model.FAKE_SETTING {
- if cfg.EmailSettings.SMTPServer == utils.Cfg.EmailSettings.SMTPServer &&
- cfg.EmailSettings.SMTPPort == utils.Cfg.EmailSettings.SMTPPort &&
- cfg.EmailSettings.SMTPUsername == utils.Cfg.EmailSettings.SMTPUsername {
- cfg.EmailSettings.SMTPPassword = utils.Cfg.EmailSettings.SMTPPassword
+ if cfg.EmailSettings.SMTPServer == a.Config().EmailSettings.SMTPServer &&
+ cfg.EmailSettings.SMTPPort == a.Config().EmailSettings.SMTPPort &&
+ cfg.EmailSettings.SMTPUsername == a.Config().EmailSettings.SMTPUsername {
+ cfg.EmailSettings.SMTPPassword = a.Config().EmailSettings.SMTPPassword
} else {
return model.NewAppError("testEmail", "api.admin.test_email.reenter_password", nil, "", http.StatusBadRequest)
}