Update main.go

This commit is contained in:
Martin/Geno 2019-06-17 15:23:52 +02:00
parent 490d7fdfe4
commit dbbe965dbf
1 changed files with 7 additions and 5 deletions

View File

@ -30,17 +30,19 @@ func init() {
return
}
contentTag := request.Status
if len(request.Alerts.Firing()) > 0 {
contentTag += ":" + len(request.Alerts.Firing())
firingAlerts := len(request.Alerts.Firing())
if firingAlerts > 0 {
content := fmt.Sprintf("[%s:%d] %s", request.Status, firingAlerts, strings.Join(request.CommonAnnotations.Values()," "))
} else {
content := fmt.Sprintf("[%s] %s", request.Status, strings.Join(request.CommonAnnotations.Values()," "))
}
content := fmt.Sprintf("[%s] %s", contentTag, strings.Join(request.CommonAnnotations.Values()," "))
logger = logger.WithField("body", content)
ok := false
for _, hook := range hooks {
if request.Payload.VCSURL != hook.Secret {
if request.ExternalURL != hook.Secret {
continue
}
logger.Infof("run hook")