mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 06:06:38 +01:00
feat(shoutrrr): update to v0.5 (#1055)
* feat(shoutrrr): update to v0.5 * fix slack URL and tests * add tests for slack icon override * bump shoutrrr to v0.5.1
This commit is contained in:
parent
bd74c05614
commit
fc31c6eb26
6 changed files with 67 additions and 28 deletions
|
|
@ -49,7 +49,7 @@ func (s *slackTypeNotifier) GetURL(c *cobra.Command) (string, error) {
|
|||
if parts[0] == "discord.com" || parts[0] == "discordapp.com" {
|
||||
log.Debug("Detected a discord slack wrapper URL, using shoutrrr discord service")
|
||||
conf := &shoutrrrDisco.Config{
|
||||
Channel: parts[len(parts)-3],
|
||||
WebhookID: parts[len(parts)-3],
|
||||
Token: parts[len(parts)-2],
|
||||
Color: ColorInt,
|
||||
Title: GetTitle(c),
|
||||
|
|
@ -59,15 +59,24 @@ func (s *slackTypeNotifier) GetURL(c *cobra.Command) (string, error) {
|
|||
return conf.GetURL().String(), nil
|
||||
}
|
||||
|
||||
rawTokens := strings.Replace(s.HookURL, "https://hooks.slack.com/services/", "", 1)
|
||||
tokens := strings.Split(rawTokens, "/")
|
||||
webhookToken := strings.Replace(s.HookURL, "https://hooks.slack.com/services/", "", 1)
|
||||
|
||||
conf := &shoutrrrSlack.Config{
|
||||
BotName: s.Username,
|
||||
Token: tokens,
|
||||
Color: ColorHex,
|
||||
Channel: "webhook",
|
||||
Title: GetTitle(c),
|
||||
}
|
||||
|
||||
if s.IconURL != "" {
|
||||
conf.Icon = s.IconURL
|
||||
} else if s.IconEmoji != "" {
|
||||
conf.Icon = s.IconEmoji
|
||||
}
|
||||
|
||||
if err := conf.Token.SetFromProp(webhookToken); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return conf.GetURL().String(), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue