From 25c67778c7f86100de3707259bf4c7a4a5ec81a1 Mon Sep 17 00:00:00 2001 From: Kunal Gupta <39487888+iamKunalGupta@users.noreply.github.com> Date: Tue, 12 Mar 2024 23:03:39 +0530 Subject: [PATCH] fix: empty reply to address from env --- flow/alerting/alerting.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flow/alerting/alerting.go b/flow/alerting/alerting.go index 6dcbc85409..fe6c8a102d 100644 --- a/flow/alerting/alerting.go +++ b/flow/alerting/alerting.go @@ -52,10 +52,15 @@ func (a *Alerter) registerSendersFromPool(ctx context.Context) ([]AlertSenderCon alertSenderConfigs = append(alertSenderConfigs, AlertSenderConfig{Id: id, Sender: newSlackAlertSender(&slackServiceConfig)}) case EMAIL: + var replyToAddresses []string + if envReplyToAddresses := strings.Split(peerdbenv.PeerDBAlertingEmailSenderReplyToAddresses(), ","); len(envReplyToAddresses) != 0 { + // AWS SDK does not like empty slice + replyToAddresses = envReplyToAddresses + } emailServiceConfig := EmailAlertSenderConfig{ sourceEmail: peerdbenv.PeerDBAlertingEmailSenderSourceEmail(), configurationSetName: peerdbenv.PeerDBAlertingEmailSenderConfigurationSet(), - replyToAddresses: strings.Split(peerdbenv.PeerDBAlertingEmailSenderReplyToAddresses(), ","), + replyToAddresses: replyToAddresses, } if emailServiceConfig.sourceEmail == "" { return errors.New("missing sourceEmail for Email alerting service")