3
0

Extend settings to hold federation enabled/disabled flag

This commit is contained in:
Denis Arh
2021-09-14 07:44:31 +02:00
parent 3705232988
commit c6f95e858f
2 changed files with 13 additions and 0 deletions

View File

@@ -474,6 +474,7 @@ func (app *CortezaApp) Activate(ctx context.Context) (err error) {
return fmt.Errorf("failed to init auth service: %w", err)
}
updateFederationSettings(app.Opt.Federation, sysService.CurrentSettings)
updateAuthSettings(app.AuthService, sysService.CurrentSettings)
sysService.DefaultSettings.Register("auth.", func(ctx context.Context, current interface{}, set types.SettingValueSet) {
appSettings, is := current.(*types.AppSettings)
@@ -577,3 +578,8 @@ func updateAuthSettings(svc authServicer, current *types.AppSettings) {
svc.UpdateSettings(as)
}
// Checks if federation is enabled in the options
func updateFederationSettings(opt options.FederationOpt, current *types.AppSettings) {
current.Federation.Enabled = opt.Enabled
}

View File

@@ -161,6 +161,13 @@ type (
}
} `kv:"compose" json:"compose"`
// Federation settings
Federation struct {
// This only holds the value of FEDERATION_ENABLED for now
//
Enabled bool `kv:"-" json:"enabled"`
} `kv:"federation" json:"federation"`
// UserInterface settings
UI struct {
MainLogo string `kv:"main-logo" json:"mainLogo"`