From 5978480b49c152e458055bb3a6b1b4ba9afa54e9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 29 Jun 2023 09:55:23 +0300 Subject: add email-notification support --- internal/quorum/notify.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'internal/quorum/notify.go') diff --git a/internal/quorum/notify.go b/internal/quorum/notify.go index b6e6b5d..7761b4d 100644 --- a/internal/quorum/notify.go +++ b/internal/quorum/notify.go @@ -17,7 +17,7 @@ func notify(conf config.Config, subject, body string) error { return nil } - log.Println("notify", subject, body) + log.Println("notify:", subject, body) headers := map[string]string{ "From": conf.EmailFrom, @@ -40,11 +40,9 @@ func notify(conf config.Config, subject, body string) error { } func notifyError(conf config.Config, err error) { - if !notifyEnabled(conf) { - return - } - - if err := notify(conf, fmt.Sprintf("GORUM: An error occured: %v", err), err.Error()); err != nil { - log.Println("error: ", err) + if notifyEnabled(conf) { + if err := notify(conf, fmt.Sprintf("GORUM: An error occured: %v", err), err.Error()); err != nil { + log.Println("error:", err) + } } } -- cgit v1.2.3