From c6f95e858f7cfec0eca86acc6d97898ea73b115d Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Tue, 14 Sep 2021 07:44:31 +0200 Subject: [PATCH] Extend settings to hold federation enabled/disabled flag --- app/boot_levels.go | 6 ++++++ system/types/app_settings.go | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/app/boot_levels.go b/app/boot_levels.go index d31f9edb7..f4cd50683 100644 --- a/app/boot_levels.go +++ b/app/boot_levels.go @@ -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 +} diff --git a/system/types/app_settings.go b/system/types/app_settings.go index 986f84193..132f1fe87 100644 --- a/system/types/app_settings.go +++ b/system/types/app_settings.go @@ -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"`