mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 06:06:38 +01:00
feat(notifications): add title field to template data (#1125)
This commit is contained in:
parent
1d59fb83dd
commit
aa02d8d31b
9 changed files with 94 additions and 35 deletions
|
|
@ -41,7 +41,7 @@ func newSlackNotifier(c *cobra.Command, acceptedLogLevels []log.Level) t.Convert
|
|||
return n
|
||||
}
|
||||
|
||||
func (s *slackTypeNotifier) GetURL(c *cobra.Command) (string, error) {
|
||||
func (s *slackTypeNotifier) GetURL(c *cobra.Command, title string) (string, error) {
|
||||
trimmedURL := strings.TrimRight(s.HookURL, "/")
|
||||
trimmedURL = strings.TrimLeft(trimmedURL, "https://")
|
||||
parts := strings.Split(trimmedURL, "/")
|
||||
|
|
@ -52,7 +52,7 @@ func (s *slackTypeNotifier) GetURL(c *cobra.Command) (string, error) {
|
|||
WebhookID: parts[len(parts)-3],
|
||||
Token: parts[len(parts)-2],
|
||||
Color: ColorInt,
|
||||
Title: GetTitle(c),
|
||||
Title: title,
|
||||
SplitLines: true,
|
||||
Username: s.Username,
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ func (s *slackTypeNotifier) GetURL(c *cobra.Command) (string, error) {
|
|||
BotName: s.Username,
|
||||
Color: ColorHex,
|
||||
Channel: "webhook",
|
||||
Title: GetTitle(c),
|
||||
Title: title,
|
||||
}
|
||||
|
||||
if s.IconURL != "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue