Remove more global refs / state (#7723)
* remove more global refs / state * fix job enterprise initialization * fix api4 test compilation * saml api endpoints fix
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
a0bfd2885d
Коммит
7ed011745a
14
app/app.go
14
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()) {
|
||||
|
||||
Ссылка в новой задаче
Block a user