diff options
Diffstat (limited to 'notif_config.go')
| -rw-r--r-- | notif_config.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/notif_config.go b/notif_config.go index c3ed43c..ca1a66b 100644 --- a/notif_config.go +++ b/notif_config.go @@ -43,7 +43,7 @@ type NotifConfig struct { Recipient []string `ini:"notif::recipient"` } -func (notifConfig *NotifConfig) init() (err error) { +func (notifConfig *NotifConfig) init(cfg *ServerConfig) (err error) { var logp = `notifConfig.init` switch notifConfig.Kind { @@ -66,7 +66,9 @@ func (notifConfig *NotifConfig) init() (err error) { default: return fmt.Errorf(`%s: unknown notif kind %q`, logp, notifConfig.Kind) } - if notifConfig.DownTemplate != "" { + if notifConfig.DownTemplate == `` { + notifConfig.downTmpl = cfg.downTmpl + } else { notifConfig.downTmpl = template.New(`down`) notifConfig.downTmpl, err = notifConfig.downTmpl.Parse(notifConfig.DownTemplate) if err != nil { @@ -74,7 +76,9 @@ func (notifConfig *NotifConfig) init() (err error) { logp, notifConfig.Kind, err) } } - if notifConfig.UpTemplate != "" { + if notifConfig.UpTemplate == `` { + notifConfig.upTmpl = cfg.upTmpl + } else { notifConfig.upTmpl = template.New(`up`) notifConfig.upTmpl, err = notifConfig.upTmpl.Parse(notifConfig.UpTemplate) if err != nil { |
