diff options
author | Chris <ccbrown112@gmail.com> | 2018-02-09 10:04:48 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-09 10:04:48 -0600 |
commit | a6309aaf48e216fe5f6779188071d4b621b643b6 (patch) | |
tree | 9abbac7f172822e2286c755725fe3533cde8de8a /app/app.go | |
parent | 7e8106b95c11a4187f8c00256f3067433d20b24e (diff) | |
download | chat-a6309aaf48e216fe5f6779188071d4b621b643b6.tar.gz chat-a6309aaf48e216fe5f6779188071d4b621b643b6.tar.bz2 chat-a6309aaf48e216fe5f6779188071d4b621b643b6.zip |
Remove license globals entirely (#8229)
* remove license globals entirely
* fix infinite recursion
* test fix
Diffstat (limited to 'app/app.go')
-rw-r--r-- | app/app.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/app/app.go b/app/app.go index 3c37ec252..dd5deb342 100644 --- a/app/app.go +++ b/app/app.go @@ -59,6 +59,10 @@ type App struct { configFile string configListeners map[string]func(*model.Config, *model.Config) + licenseValue atomic.Value + clientLicenseValue atomic.Value + licenseListeners map[string]func() + newStore func() store.Store htmlTemplateWatcher *utils.HTMLTemplateWatcher @@ -88,18 +92,16 @@ func New(options ...Option) (*App, error) { panic("Only one App should exist at a time. Did you forget to call Shutdown()?") } - // TODO: remove this once utils global license state is eliminated - utils.SetLicense(nil) - app := &App{ goroutineExitSignal: make(chan struct{}, 1), Srv: &Server{ Router: mux.NewRouter(), }, - sessionCache: utils.NewLru(model.SESSION_CACHE_SIZE), - configFile: "config.json", - configListeners: make(map[string]func(*model.Config, *model.Config)), - clientConfig: make(map[string]string), + sessionCache: utils.NewLru(model.SESSION_CACHE_SIZE), + configFile: "config.json", + configListeners: make(map[string]func(*model.Config, *model.Config)), + clientConfig: make(map[string]string), + licenseListeners: map[string]func(){}, } for _, option := range options { @@ -123,9 +125,9 @@ func New(options ...Option) (*App, error) { app.configListenerId = app.AddConfigListener(func(_, _ *model.Config) { app.configOrLicenseListener() }) - app.licenseListenerId = utils.AddLicenseListener(app.configOrLicenseListener) + app.licenseListenerId = app.AddLicenseListener(app.configOrLicenseListener) app.regenerateClientConfig() - app.SetDefaultRolesBasedOnConfig() + app.setDefaultRolesBasedOnConfig() l4g.Info(utils.T("api.server.new_server.init.info")) @@ -166,7 +168,7 @@ func New(options ...Option) (*App, error) { func (a *App) configOrLicenseListener() { a.regenerateClientConfig() - a.SetDefaultRolesBasedOnConfig() + a.setDefaultRolesBasedOnConfig() } func (a *App) Shutdown() { @@ -188,7 +190,7 @@ func (a *App) Shutdown() { } a.RemoveConfigListener(a.configListenerId) - utils.RemoveLicenseListener(a.licenseListenerId) + a.RemoveLicenseListener(a.licenseListenerId) l4g.Info(utils.T("api.server.stop_server.stopped.info")) a.DisableConfigWatch() |