From 7ed011745a544873f40f806f1803cb8a4998ba01 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 26 Oct 2017 14:21:22 -0500 Subject: Remove more global refs / state (#7723) * remove more global refs / state * fix job enterprise initialization * fix api4 test compilation * saml api endpoints fix --- app/app.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'app/app.go') diff --git a/app/app.go b/app/app.go index c82520cd9..002a6a272 100644 --- a/app/app.go +++ b/app/app.go @@ -48,6 +48,8 @@ type App struct { Saml einterfaces.SamlInterface newStore func() store.Store + + sessionCache *utils.Cache } var appCount = 0 @@ -64,10 +66,10 @@ func New(options ...Option) *App { app := &App{ goroutineExitSignal: make(chan struct{}, 1), - Jobs: &jobs.JobServer{}, Srv: &Server{ Router: mux.NewRouter(), }, + sessionCache: utils.NewLru(model.SESSION_CACHE_SIZE), } app.initEnterprise() @@ -82,7 +84,7 @@ func New(options ...Option) *App { } app.Srv.Store = app.newStore() - app.Jobs.Store = app.Srv.Store + app.initJobs() app.Srv.Router.NotFoundHandler = http.HandlerFunc(app.Handle404) @@ -218,6 +220,10 @@ func (a *App) initEnterprise() { if dataRetentionInterface != nil { a.DataRetention = dataRetentionInterface(a) } +} + +func (a *App) initJobs() { + a.Jobs = jobs.NewJobServer(a.Config, a.Srv.Store) if jobsDataRetentionJobInterface != nil { a.Jobs.DataRetentionJob = jobsDataRetentionJobInterface(a) } @@ -240,6 +246,10 @@ func (a *App) UpdateConfig(f func(*model.Config)) { f(utils.Cfg) } +func (a *App) ConfigFileName() string { + return utils.CfgFileName +} + // Go creates a goroutine, but maintains a record of it to ensure that execution completes before // the app is destroyed. func (a *App) Go(f func()) { -- cgit v1.2.3-1-g7c22