Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
abdegenius committed Nov 6, 2024
1 parent 919ff67 commit 9cc0cdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions cmd/relayproxy/config/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions notifier/microsoftteamsnotifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func convertUpdatedFlagsToMicrosoftTeamsMessage(diffCache notifier.DiffCache) []
}
}

sort.Sort(ByTitle(attachment.Fields))
sort.Sort(byTitle(attachment.Fields))

attachments = append(attachments, attachment)
}
Expand Down Expand Up @@ -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] }

0 comments on commit 9cc0cdd

Please sign in to comment.