diff --git a/go.mod b/go.mod index 1690237..b5be153 100644 --- a/go.mod +++ b/go.mod @@ -59,7 +59,6 @@ require ( golang.org/x/crypto v0.0.0-20190403202508-8e1b8d32e692 golang.org/x/net v0.0.0-20190522155817-f3200d17e092 golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e - google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190401181712-f467c93bbac2 google.golang.org/grpc v1.21.0 gotest.tools v2.2.0+incompatible // indirect diff --git a/internal/flags/flags.go b/internal/flags/flags.go index 3f3d8fc..7ab09bd 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -179,7 +179,7 @@ Should only be used for testing. "", viper.GetString("WATCHTOWER_NOTIFICATION_EMAIL_SUBJECTTAG"), "Subject prefix tag for notifications via mail") - + flags.StringP( "notification-slack-hook-url", "", diff --git a/pkg/notifications/email.go b/pkg/notifications/email.go index 4916d40..ca54499 100644 --- a/pkg/notifications/email.go +++ b/pkg/notifications/email.go @@ -23,13 +23,13 @@ const ( // - It would only send errors // We work around that by holding on to log entries until the update cycle is done. type emailTypeNotifier struct { - From, To string + From, To string Server, User, Password, SubjectTag string - Port int - tlsSkipVerify bool - entries []*log.Entry - logLevels []log.Level - delay time.Duration + Port int + tlsSkipVerify bool + entries []*log.Entry + logLevels []log.Level + delay time.Duration } func newEmailNotifier(c *cobra.Command, acceptedLogLevels []log.Level) t.Notifier { @@ -64,10 +64,12 @@ func newEmailNotifier(c *cobra.Command, acceptedLogLevels []log.Level) t.Notifie } func (e *emailTypeNotifier) buildMessage(entries []*log.Entry) []byte { - if SubjectTag == "" { - emailSubject := "Watchtower updates" + var emailSubject string + + if e.SubjectTag == "" { + emailSubject = "Watchtower updates" } else { - emailSubject := SubjectTag + " Watchtower updates" + emailSubject = e.SubjectTag + " Watchtower updates" } if hostname, err := os.Hostname(); err == nil { emailSubject += " on " + hostname @@ -134,7 +136,7 @@ func (e *emailTypeNotifier) SendNotification() { time.Sleep(e.delay) } - e.sendEntries(e.entries) + e.sendEntries(e.entries) e.entries = nil }