From d30cfabbcba4cd808e4fba89f4a25f120b0847b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= Date: Wed, 7 Sep 2022 15:22:46 +0200 Subject: [PATCH] add GetURLs for notifier --- pkg/notifications/shoutrrr.go | 8 ++++++-- pkg/types/notifier.go | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/notifications/shoutrrr.go b/pkg/notifications/shoutrrr.go index 04436a0..6eccd33 100644 --- a/pkg/notifications/shoutrrr.go +++ b/pkg/notifications/shoutrrr.go @@ -61,8 +61,12 @@ func (n *shoutrrrTypeNotifier) GetNames() []string { return names } -func newShoutrrrNotifier(tplString string, levels []log.Level, legacy bool, data StaticData, delay time.Duration, stdout bool, urls ...string) t.Notifier { +// GetNames returns a list of URLs for notification services that has been added +func (n *shoutrrrTypeNotifier) GetURLs() []string { + return n.Urls +} +// AddLogHook adds the notifier as a receiver of log messages and starts a go func for processing them func (n *shoutrrrTypeNotifier) AddLogHook() { if n.receiving { return @@ -74,7 +78,7 @@ func (n *shoutrrrTypeNotifier) AddLogHook() { go sendNotifications(n) } -func createNotifier(urls []string, levels []log.Level, tplString string, legacy bool, data StaticData, stdout bool) *shoutrrrTypeNotifier { +func createNotifier(urls []string, levels []log.Level, tplString string, legacy bool, data StaticData, stdout bool, delay time.Duration) *shoutrrrTypeNotifier { tpl, err := getShoutrrrTemplate(tplString, legacy) if err != nil { log.Errorf("Could not use configured notification template: %s. Using default template", err) diff --git a/pkg/types/notifier.go b/pkg/types/notifier.go index 6fcf042..478a4c4 100644 --- a/pkg/types/notifier.go +++ b/pkg/types/notifier.go @@ -6,5 +6,6 @@ type Notifier interface { SendNotification(Report) AddLogHook() GetNames() []string + GetURLs() []string Close() }