Add hierarchical naming for templates

This commit is contained in:
Fabian Reinartz 2015-10-11 17:09:59 +02:00
parent ce74f8363b
commit ce15d774d6
2 changed files with 16 additions and 16 deletions

View File

@ -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",
},
}
)

View File

@ -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 }}