Skip to content

Commit 8e1a146

Browse files
committed
fix cluster mailer not updated after credentials change
1 parent 35dc9ec commit 8e1a146

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

server/api_cluster.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -2781,12 +2781,15 @@ func (repman *ReplicationManager) setClusterSetting(mycluster *cluster.Cluster,
27812781
new_secret.Value = mycluster.Conf.MailSMTPPassword
27822782
new_secret.OldValue = mycluster.Conf.GetDecryptedValue("mail-smtp-password")
27832783
mycluster.Conf.Secrets["mail-smtp-password"] = new_secret
2784+
mycluster.Mailer.UpdateAuth(mycluster.Conf.MailSMTPUser, new_secret.Value)
27842785
case "mail-smtp-user":
27852786
mycluster.Conf.SetMailSmtpUser(value)
2787+
mycluster.Mailer.UpdateAuth(value, mycluster.Conf.GetDecryptedValue("mail-smtp-password"))
27862788
case "mail-to":
27872789
mycluster.Conf.SetMailTo(value)
27882790
case "mail-from":
27892791
mycluster.Conf.SetMailFrom(value)
2792+
mycluster.Mailer.SetFrom(value)
27902793
case "scheduler-alert-disable-time":
27912794
val, _ := strconv.Atoi(value)
27922795
mycluster.SetSchedulerAlertDisableTime(val)
@@ -3528,14 +3531,15 @@ func (repman *ReplicationManager) setRepmanSetting(name string, value string) er
35283531
new_secret.Value = repman.Conf.MailSMTPPassword
35293532
new_secret.OldValue = repman.Conf.GetDecryptedValue("mail-smtp-password")
35303533
repman.Conf.Secrets["mail-smtp-password"] = new_secret
3531-
repman.Mailer.UpdateAuth(repman.Conf.MailSMTPUser, repman.Conf.MailSMTPPassword)
3534+
repman.Mailer.UpdateAuth(repman.Conf.MailSMTPUser, new_secret.Value)
35323535
case "mail-smtp-user":
35333536
repman.Conf.SetMailSmtpUser(value)
3534-
repman.Mailer.UpdateAuth(repman.Conf.MailSMTPUser, repman.Conf.MailSMTPPassword)
3537+
repman.Mailer.UpdateAuth(repman.Conf.MailSMTPUser, repman.Conf.GetDecryptedValue("mail-smtp-password"))
35353538
case "mail-to":
35363539
repman.Conf.SetMailTo(value)
35373540
case "mail-from":
35383541
repman.Conf.SetMailFrom(value)
3542+
repman.Mailer.SetFrom(value)
35393543
case "cloud18-shared":
35403544
if repman.Conf.Cloud18 {
35413545
repman.Conf.Cloud18Shared = isactive

utils/alert/mailer/mailer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (m *Mailer) UpdateTimeout(timeout int) {
148148
}
149149
}
150150

151-
func (m *Mailer) UpdateFrom(mailFrom string) {
151+
func (m *Mailer) SetFrom(mailFrom string) {
152152
m.From = mailFrom
153153
}
154154

0 commit comments

Comments
 (0)