When I notify alert to slack, I want to use this option. (#912)
* add link_names attribute to slack notifier * changed type of slack option `link_names` to boolean
This commit is contained in:
parent
040b1f9e53
commit
e1b2bfe497
|
@ -218,6 +218,7 @@ type SlackConfig struct {
|
|||
Fallback string `yaml:"fallback,omitempty" json:"fallback,omitempty"`
|
||||
IconEmoji string `yaml:"icon_emoji,omitempty" json:"icon_emoji,omitempty"`
|
||||
IconURL string `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
|
||||
LinkNames bool `yaml:"link_names,omitempty" json:"link_names,omitempty"`
|
||||
|
||||
// Catches all undefined fields and must be empty after parsing.
|
||||
XXX map[string]interface{} `yaml:",inline" json:"-"`
|
||||
|
|
|
@ -498,6 +498,7 @@ type slackReq struct {
|
|||
Username string `json:"username,omitempty"`
|
||||
IconEmoji string `json:"icon_emoji,omitempty"`
|
||||
IconURL string `json:"icon_url,omitempty"`
|
||||
LinkNames bool `json:"link_names,omitempty"`
|
||||
Attachments []slackAttachment `json:"attachments"`
|
||||
}
|
||||
|
||||
|
@ -542,6 +543,7 @@ func (n *Slack) Notify(ctx context.Context, as ...*types.Alert) (bool, error) {
|
|||
Username: tmplText(n.conf.Username),
|
||||
IconEmoji: tmplText(n.conf.IconEmoji),
|
||||
IconURL: tmplText(n.conf.IconURL),
|
||||
LinkNames: n.conf.LinkNames,
|
||||
Attachments: []slackAttachment{*attachment},
|
||||
}
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue