Skip to content

Commit

Permalink
fix: issue with empty replyTo env
Browse files Browse the repository at this point in the history
  • Loading branch information
iamKunalGupta committed Mar 12, 2024
1 parent 396d281 commit ff46929
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 5 additions & 1 deletion flow/alerting/alerting.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ func (a *Alerter) registerSendersFromPool(ctx context.Context) ([]AlertSenderCon

alertSenderConfigs = append(alertSenderConfigs, AlertSenderConfig{Id: id, Sender: newSlackAlertSender(&slackServiceConfig)})
case EMAIL:
var replyToAddresses []string
if envString := strings.TrimSpace(peerdbenv.PeerDBAlertingEmailSenderReplyToAddresses()); len(envString) != 0 {

Check failure on line 56 in flow/alerting/alerting.go

View workflow job for this annotation

GitHub Actions / lint

emptyStringTest: replace `len(envString) != 0` with `envString != ""` (gocritic)
replyToAddresses = strings.Split(envString, ",")
}
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")
Expand Down
6 changes: 1 addition & 5 deletions flow/alerting/email_alert_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,11 @@ func NewEmailAlertSenderWithNewClient(ctx context.Context, region *string, confi
}

func NewEmailAlertSender(client *ses.Client, config *EmailAlertSenderConfig) *EmailAlertSender {
replyToAddresses := config.replyToAddresses
if len(replyToAddresses) == 0 {
replyToAddresses = []string{config.sourceEmail}
}
return &EmailAlertSender{
client: client,
sourceEmail: config.sourceEmail,
configurationSetName: config.configurationSetName,
replyToAddresses: replyToAddresses,
replyToAddresses: config.replyToAddresses,
slotLagMBAlertThreshold: config.SlotLagMBAlertThreshold,
openConnectionsAlertThreshold: config.OpenConnectionsAlertThreshold,
emailAddresses: config.EmailAddresses,
Expand Down

0 comments on commit ff46929

Please sign in to comment.