From 9cc0cdd0b463ee74383b1a2a2754ae409ff58b6c Mon Sep 17 00:00:00 2001 From: abdegenius Date: Wed, 6 Nov 2024 18:33:05 +0100 Subject: [PATCH] Updates --- cmd/relayproxy/config/notifier.go | 5 ++--- notifier/microsoftteamsnotifier/notifier.go | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/relayproxy/config/notifier.go b/cmd/relayproxy/config/notifier.go index 1852760fc64..7310f18a8eb 100644 --- a/cmd/relayproxy/config/notifier.go +++ b/cmd/relayproxy/config/notifier.go @@ -6,7 +6,6 @@ type NotifierConf struct { Kind NotifierKind `mapstructure:"kind" koanf:"kind"` // Deprecated: Use WebhookURL instead SlackWebhookURL string `mapstructure:"slackWebhookUrl" koanf:"slackWebhookUrl"` - MicrosoftTeamsWebhookURL string `mapstructure:"microsoftteamsWebhookUrl" koanf:"microsoftteamsWebhookUrl"` EndpointURL string `mapstructure:"endpointUrl" koanf:"endpointUrl"` Secret string `mapstructure:"secret" koanf:"secret"` Meta map[string]string `mapstructure:"meta" koanf:"meta"` @@ -21,8 +20,8 @@ func (c *NotifierConf) IsValid() error { if c.Kind == SlackNotifier && c.SlackWebhookURL == "" { return fmt.Errorf("invalid notifier: no \"slackWebhookUrl\" property found for kind \"%s\"", c.Kind) } - if c.Kind == MicrosoftTeamsNotifier && c.MicrosoftTeamsWebhookURL == "" { - return fmt.Errorf("invalid notifier: no \"microsoftteamsWebhookUrl\" property found for kind \"%s\"", c.Kind) + if c.Kind == MicrosoftTeamsNotifier && c.WebhookURL == "" { + return fmt.Errorf("invalid notifier: no \"webhookURL\" property found for kind \"%s\"", c.Kind) } if c.Kind == WebhookNotifier && c.EndpointURL == "" { return fmt.Errorf("invalid notifier: no \"endpointUrl\" property found for kind \"%s\"", c.Kind) diff --git a/notifier/microsoftteamsnotifier/notifier.go b/notifier/microsoftteamsnotifier/notifier.go index ca3e268de2f..96ccccee9cb 100644 --- a/notifier/microsoftteamsnotifier/notifier.go +++ b/notifier/microsoftteamsnotifier/notifier.go @@ -134,7 +134,7 @@ func convertUpdatedFlagsToMicrosoftTeamsMessage(diffCache notifier.DiffCache) [] } } - sort.Sort(ByTitle(attachment.Fields)) + sort.Sort(byTitle(attachment.Fields)) attachments = append(attachments, attachment) } @@ -205,8 +205,8 @@ type Field struct { Short bool `json:"short"` } -type ByTitle []Field +type byTitle []Field -func (a ByTitle) Len() int { return len(a) } -func (a ByTitle) Less(i, j int) bool { return a[i].Title < a[j].Title } -func (a ByTitle) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byTitle) Len() int { return len(a) } +func (a byTitle) Less(i, j int) bool { return a[i].Title < a[j].Title } +func (a byTitle) Swap(i, j int) { a[i], a[j] = a[j], a[i] }