fix some var ref errors

pull/421/head
Simon Aronsson 5 years ago
parent 6910ad8c4e
commit ea596ea747

@ -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

@ -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",
"",

@ -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
}

Loading…
Cancel
Save