Update defaults and add tests for them

This commit is contained in:
Ian Fijolek
2025-12-11 16:06:01 -08:00
parent 85afa3d9ef
commit 5c97f2e5c4
7 changed files with 105 additions and 29 deletions
+2 -2
View File
@@ -101,14 +101,14 @@ func (alert *Alert) BuildTemplates() error {
}
switch {
case alert.commandTemplate == nil && alert.Command != nil:
case alert.Command != nil:
alert.commandTemplate = []*template.Template{}
for i, cmdPart := range alert.Command {
alert.commandTemplate = append(alert.commandTemplate, template.Must(
template.New(alert.Name+fmt.Sprint(i)).Funcs(timeFormatFuncs).Parse(cmdPart),
))
}
case alert.commandShellTemplate == nil && alert.ShellCommand != "":
case alert.ShellCommand != "":
shellCmd := alert.ShellCommand
alert.commandShellTemplate = template.Must(