3
0

Move fed-is-enabled checks to boot procedure

This commit is contained in:
Denis Arh 2020-12-14 14:50:05 +01:00
parent e9d1d9cc3f
commit a37ea6272e
2 changed files with 16 additions and 15 deletions

View File

@ -240,17 +240,19 @@ func (app *CortezaApp) InitServices(ctx context.Context) (err error) {
PingPeriod: app.Opt.Websocket.PingPeriod,
})
// Initializes federation services
//
// Note: this is a legacy approach, all services from all 3 apps
// will most likely be merged in the future
err = fdrService.Initialize(ctx, app.Log, app.Store, fdrService.Config{
ActionLog: app.Opt.ActionLog,
Federation: app.Opt.Federation,
})
if app.Opt.Federation.Enabled {
// Initializes federation services
//
// Note: this is a legacy approach, all services from all 3 apps
// will most likely be merged in the future
err = fdrService.Initialize(ctx, app.Log, app.Store, fdrService.Config{
ActionLog: app.Opt.ActionLog,
Federation: app.Opt.Federation,
})
if err != nil {
return
if err != nil {
return
}
}
// Initialize external authentication (from default settings)
@ -314,7 +316,10 @@ func (app *CortezaApp) Activate(ctx context.Context) (err error) {
sysService.Watchers(ctx)
cmpService.Watchers(ctx)
msgService.Watchers(ctx)
fedService.Watchers(ctx)
if app.Opt.Federation.Enabled {
fedService.Watchers(ctx)
}
rbac.Global().Watch(ctx)

View File

@ -95,10 +95,6 @@ func Initialize(ctx context.Context, log *zap.Logger, s store.Storer, c Config)
}
func Watchers(ctx context.Context) {
if !DefaultOptions.Enabled {
return
}
DefaultLogger.Info("Starting federation - warning, this is still an experimental feature")
syncService := NewSync(