Skip to content

Commit

Permalink
move check further down to increase test coverage slightly
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Horton <[email protected]>
  • Loading branch information
madpah committed Aug 13, 2024
1 parent 4891958 commit 77657f9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,6 @@ func notifySignatureComplete(signature *types.UserSignature) (err error) {
smtpPassword := os.Getenv(envSmtpPassword)
notificationAddress := os.Getenv(envNotificationAddress)

if smtpHost == "" || smtpPort == "" || notificationAddress == "" {
logger.Error("SMTP Host, SMTP Port or Notification Address are empty - cannot send notification")
return errors.New("SMTP Host, SMTP Port or Notification Address are empty - cannot send notification")
}

logger.Info("Preparing SMTP...")
auth := smtp.PlainAuth("", smtpUsername, smtpPassword, smtpHost)
to := []string{notificationAddress}
Expand All @@ -549,6 +544,11 @@ func notifySignatureComplete(signature *types.UserSignature) (err error) {

"CLA Text below was as signed (obtained from " + signature.CLATextUrl + "):\r\n\r\n" + signature.CLAText)

if smtpHost == "" || smtpPort == "" || notificationAddress == "" {
logger.Error("SMTP Host, SMTP Port or Notification Address are empty - cannot send notification")
return errors.New("SMTP Host, SMTP Port or Notification Address are empty - cannot send notification")
}

logger.Debug("Calling SMTP Send...")
err = smtp.SendMail(fmt.Sprintf("%s:%s", smtpHost, smtpPort), auth, "[email protected]", to, msg)
logger.Debug("SMTP Send Complete", zap.Error(err))
Expand Down

0 comments on commit 77657f9

Please sign in to comment.