summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Dittberner <jandd@cacert.org>2018-03-29 22:00:56 +0200
committerJan Dittberner <jandd@cacert.org>2018-03-29 22:00:56 +0200
commit5d68bae54fc48854103dcc70ef236f8ae39f136b (patch)
treecb607c91521ebd9398af178c3bf2f698da11aab5
parent94dcb5bd75faa4adaef9f56df197a42a5e978718 (diff)
downloadcacert-boardvoting-5d68bae54fc48854103dcc70ef236f8ae39f136b.tar.gz
cacert-boardvoting-5d68bae54fc48854103dcc70ef236f8ae39f136b.tar.xz
cacert-boardvoting-5d68bae54fc48854103dcc70ef236f8ae39f136b.zip
Use assets for mail templates
-rw-r--r--notifications.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/notifications.go b/notifications.go
index cf94898..25234ff 100644
--- a/notifications.go
+++ b/notifications.go
@@ -3,6 +3,7 @@ package main
import (
"bytes"
"fmt"
+ "git.cacert.org/cacert-boardvoting/boardvoting"
"github.com/Masterminds/sprig"
"gopkg.in/gomail.v2"
"text/template"
@@ -68,8 +69,11 @@ func MailNotifier(quitMailNotifier chan int) {
}
func buildMail(templateName string, context interface{}) (mailText *bytes.Buffer, err error) {
- t, err := template.New(templateName).Funcs(
- sprig.GenericFuncMap()).ParseFiles(fmt.Sprintf("templates/%s", templateName))
+ b, err := boardvoting.Asset(fmt.Sprintf("templates/%s", templateName))
+ if err != nil {
+ return
+ }
+ t, err := template.New(templateName).Funcs(sprig.GenericFuncMap()).Parse(string(b))
if err != nil {
return
}