diff options
author | Chris <ccbrown112@gmail.com> | 2017-11-16 08:40:26 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-16 08:40:26 -0600 |
commit | bf6bb9bce9723799991478e5aea745686045ad65 (patch) | |
tree | f9d84501c5db96563f53410aaa546aac8085157f /app | |
parent | 6eb4b4604c79b0052cb7ab8ac97c9b90fa61e918 (diff) | |
download | chat-bf6bb9bce9723799991478e5aea745686045ad65.tar.gz chat-bf6bb9bce9723799991478e5aea745686045ad65.tar.bz2 chat-bf6bb9bce9723799991478e5aea745686045ad65.zip |
fix config cli option (#7850)
Diffstat (limited to 'app')
-rw-r--r-- | app/app.go | 23 | ||||
-rw-r--r-- | app/options.go | 6 |
2 files changed, 19 insertions, 10 deletions
diff --git a/app/app.go b/app/app.go index 81db20830..4be897f59 100644 --- a/app/app.go +++ b/app/app.go @@ -48,7 +48,8 @@ type App struct { Mfa einterfaces.MfaInterface Saml einterfaces.SamlInterface - newStore func() store.Store + configFile string + newStore func() store.Store sessionCache *utils.Cache } @@ -63,27 +64,29 @@ func New(options ...Option) *App { panic("Only one App should exist at a time. Did you forget to call Shutdown()?") } - if utils.T == nil { - utils.TranslationsPreInit() - } - utils.LoadGlobalConfig("config.json") - utils.InitTranslations(utils.Cfg.LocalizationSettings) - - l4g.Info(utils.T("api.server.new_server.init.info")) - app := &App{ goroutineExitSignal: make(chan struct{}, 1), Srv: &Server{ Router: mux.NewRouter(), }, sessionCache: utils.NewLru(model.SESSION_CACHE_SIZE), + configFile: "config.json", } - app.initEnterprise() for _, option := range options { option(app) } + if utils.T == nil { + utils.TranslationsPreInit() + } + utils.LoadGlobalConfig(app.configFile) + utils.InitTranslations(utils.Cfg.LocalizationSettings) + + l4g.Info(utils.T("api.server.new_server.init.info")) + + app.initEnterprise() + if app.newStore == nil { app.newStore = func() store.Store { return store.NewLayeredStore(sqlstore.NewSqlSupplier(app.Config().SqlSettings, app.Metrics), app.Metrics, app.Cluster) diff --git a/app/options.go b/app/options.go index 34fa92d93..9b40806f3 100644 --- a/app/options.go +++ b/app/options.go @@ -29,3 +29,9 @@ func StoreOverride(override interface{}) Option { } } } + +func ConfigFile(file string) Option { + return func(a *App) { + a.configFile = file + } +} |