From 4db9d060b737d633743b72bf9285d99bf5fd8444 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Mon, 7 Nov 2022 15:44:36 +0100 Subject: [PATCH 1/2] add NOTIFICATIONS_WEB_UI_URL --- changelog/unreleased/fix-notifications-web-ui-url.md | 7 +++++++ services/notifications/pkg/command/server.go | 2 +- services/notifications/pkg/config/config.go | 2 ++ .../notifications/pkg/config/defaults/defaultconfig.go | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/fix-notifications-web-ui-url.md diff --git a/changelog/unreleased/fix-notifications-web-ui-url.md b/changelog/unreleased/fix-notifications-web-ui-url.md new file mode 100644 index 000000000..936fc582b --- /dev/null +++ b/changelog/unreleased/fix-notifications-web-ui-url.md @@ -0,0 +1,7 @@ +Bugfix: Fix notifications Web UI url + +We've fixed the configuration of the notification service's Web UI url that appears in emails. + +Previously it was only configurable via the global "OCIS_URL" and is now also configurable via "NOTIFICATIONS_WEB_UI_URL". + +https://github.com/owncloud/ocis/pull/4998 diff --git a/services/notifications/pkg/command/server.go b/services/notifications/pkg/command/server.go index 8110c34f5..bc4316dc9 100644 --- a/services/notifications/pkg/command/server.go +++ b/services/notifications/pkg/command/server.go @@ -91,7 +91,7 @@ func Server(cfg *config.Config) *cli.Command { logger.Fatal().Err(err).Str("addr", cfg.Notifications.RevaGateway).Msg("could not get reva client") } - svc := service.NewEventsNotifier(evts, channel, logger, gwclient, cfg.Notifications.MachineAuthAPIKey, cfg.Notifications.EmailTemplatePath, cfg.Commons.OcisURL) + svc := service.NewEventsNotifier(evts, channel, logger, gwclient, cfg.Notifications.MachineAuthAPIKey, cfg.Notifications.EmailTemplatePath, cfg.WebUiURL) return svc.Run() }, } diff --git a/services/notifications/pkg/config/config.go b/services/notifications/pkg/config/config.go index fc3847236..522fee61a 100644 --- a/services/notifications/pkg/config/config.go +++ b/services/notifications/pkg/config/config.go @@ -15,6 +15,8 @@ type Config struct { Log *Log `yaml:"log"` Debug Debug `yaml:"debug"` + WebUiURL string `yaml:"ocis_url" env:"OCIS_URL;NOTIFICATIONS_WEB_UI_URL" desc:"The public facing URL of the oCIS Web UI."` + Notifications Notifications `yaml:"notifications"` Context context.Context `yaml:"-"` diff --git a/services/notifications/pkg/config/defaults/defaultconfig.go b/services/notifications/pkg/config/defaults/defaultconfig.go index fd61a028b..829d17042 100644 --- a/services/notifications/pkg/config/defaults/defaultconfig.go +++ b/services/notifications/pkg/config/defaults/defaultconfig.go @@ -23,6 +23,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "notifications", }, + WebUiURL: "https://localhost:9200", Notifications: config.Notifications{ SMTP: config.SMTP{ Host: "", From 61be11a651de504319c1e3ed38bc7ba704b2e8d0 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Tue, 8 Nov 2022 09:23:05 +0100 Subject: [PATCH 2/2] improve description --- services/notifications/pkg/command/server.go | 2 +- services/notifications/pkg/config/config.go | 2 +- services/notifications/pkg/config/defaults/defaultconfig.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/notifications/pkg/command/server.go b/services/notifications/pkg/command/server.go index bc4316dc9..bef9c13c9 100644 --- a/services/notifications/pkg/command/server.go +++ b/services/notifications/pkg/command/server.go @@ -91,7 +91,7 @@ func Server(cfg *config.Config) *cli.Command { logger.Fatal().Err(err).Str("addr", cfg.Notifications.RevaGateway).Msg("could not get reva client") } - svc := service.NewEventsNotifier(evts, channel, logger, gwclient, cfg.Notifications.MachineAuthAPIKey, cfg.Notifications.EmailTemplatePath, cfg.WebUiURL) + svc := service.NewEventsNotifier(evts, channel, logger, gwclient, cfg.Notifications.MachineAuthAPIKey, cfg.Notifications.EmailTemplatePath, cfg.WebUIURL) return svc.Run() }, } diff --git a/services/notifications/pkg/config/config.go b/services/notifications/pkg/config/config.go index 522fee61a..f208a20b4 100644 --- a/services/notifications/pkg/config/config.go +++ b/services/notifications/pkg/config/config.go @@ -15,7 +15,7 @@ type Config struct { Log *Log `yaml:"log"` Debug Debug `yaml:"debug"` - WebUiURL string `yaml:"ocis_url" env:"OCIS_URL;NOTIFICATIONS_WEB_UI_URL" desc:"The public facing URL of the oCIS Web UI."` + WebUIURL string `yaml:"ocis_url" env:"OCIS_URL;NOTIFICATIONS_WEB_UI_URL" desc:"The public facing URL of the oCIS Web UI, used e.g. when sending notification eMails"` Notifications Notifications `yaml:"notifications"` diff --git a/services/notifications/pkg/config/defaults/defaultconfig.go b/services/notifications/pkg/config/defaults/defaultconfig.go index 829d17042..20e3582d8 100644 --- a/services/notifications/pkg/config/defaults/defaultconfig.go +++ b/services/notifications/pkg/config/defaults/defaultconfig.go @@ -23,7 +23,7 @@ func DefaultConfig() *config.Config { Service: config.Service{ Name: "notifications", }, - WebUiURL: "https://localhost:9200", + WebUIURL: "https://localhost:9200", Notifications: config.Notifications{ SMTP: config.SMTP{ Host: "",