From ce15d774d640de9c83a474caa68c686c5a84fa52 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Sun, 11 Oct 2015 17:09:59 +0200 Subject: [PATCH] Add hierarchical naming for templates --- config/notifies.go | 16 ++++++++-------- template/default.tmpl | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/config/notifies.go b/config/notifies.go index a06de3d5..209a5b42 100644 --- a/config/notifies.go +++ b/config/notifies.go @@ -29,19 +29,19 @@ var ( ColorResolved: "good", Templates: SlackTemplates{ - Title: "slack_default_title", - TitleLink: "slack_default_title_link", - Pretext: "slack_default_pretext", - Text: "slack_default_text", - Fallback: "slack_default_fallback", + Title: "slack.default.title", + TitleLink: "slack.default.title_link", + Pretext: "slack.default.pretext", + Text: "slack.default.text", + Fallback: "slack.default.fallback", }, } DefaultEmailConfig = EmailConfig{ Templates: EmailTemplates{ - Header: "email_default_header", - HTML: "email_default_html", - Plain: "email_default_plain", + Header: "email.default.header", + HTML: "email.default.html", + Plain: "email.default.plain", }, } ) diff --git a/template/default.tmpl b/template/default.tmpl index f991408f..00246680 100644 --- a/template/default.tmpl +++ b/template/default.tmpl @@ -1,38 +1,38 @@ -{{ define "slack_default_fallback" }} +{{ define "slack.default.fallback" }} fallback {{ end }} -{{ define "slack_default_pretext" }} +{{ define "slack.default.pretext" }} pre text {{ end }} -{{ define "slack_default_title" }} +{{ define "slack.default.title" }} Title {{ end }} -{{ define "slack_default_titlelink" }} +{{ define "slack.default.titlelink" }} http://localhost:9090 {{ end }} -{{ define "slack_default_text" }} +{{ define "slack.default.text" }} my text my text my text {{ end }} -{{ define "email_default_header" }}From: "Prometheus Alertmanager" <{{ .From }}> +{{ define "email.default.header" }}From: "Prometheus Alertmanager" <{{ .From }}> To: {{ .To }} Date: {{ .Date }} Subject: [{{ .Alerts.Status }}] {{ end }} -{{ define "email_default_plain" }} +{{ define "email.default.plain" }} {{ range .Alerts }} {{ .String }} {{ end }} {{ end }} -{{ define "email_default_html" }} +{{ define "email.default.html" }} {{ range .Alerts }} {{ .String }} {{ end }}