Skip to content

Commit

Permalink
fix: Fix bug in reading template
Browse files Browse the repository at this point in the history
Fixes bug in case the user specifies a custom location
for template file.
  • Loading branch information
mr-karan committed Jan 11, 2019
1 parent 0b744b8 commit 9c86e9b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"html/template"
"strings"

"github.com/spf13/viper"

alerttemplate "github.com/prometheus/alertmanager/template"
"github.com/spf13/viper"
)

func sendMessageToChat(alerts []alerttemplate.Alert, notif *Notifier, webHookURL string) error {
Expand All @@ -21,7 +20,7 @@ func sendMessageToChat(alerts []alerttemplate.Alert, notif *Notifier, webHookURL
"toUpper": strings.ToUpper,
}
// read template file
tmpl, err := template.New(viper.GetString("app.template_file")).Funcs(templateFuncMap).ParseFiles(viper.GetString("app.template_file"))
tmpl, err := template.New("message.tmpl").Funcs(templateFuncMap).ParseFiles(viper.GetString("app.template_file"))
if err != nil {
errLog.Printf("Error reading template %s", err)
return err
Expand Down

0 comments on commit 9c86e9b

Please sign in to comment.