From 68a00c91db68b47c981d673606171bde9e3ff6da Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Wed, 25 May 2022 17:39:57 -0500 Subject: [PATCH] Rename the email override field for clarity --- src/config/config.go.example | 13 +++++++------ src/config/types.go | 12 ++++++------ src/email/email.go | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/config/config.go.example b/src/config/config.go.example index 3044378..d580f59 100644 --- a/src/config/config.go.example +++ b/src/config/config.go.example @@ -30,12 +30,13 @@ var Config = HMNConfig{ AtomPassword: "password", }, Email: EmailConfig{ - ServerAddress: "smtp.example.com", - ServerPort: 587, - FromAddress: "noreply@example.com", - FromAddressPassword: "", - FromName: "Handmade Network Team", - OverrideRecipientEmail: "override@handmade.network", // NOTE(asaf): If this is not empty, all emails will be redirected to this address. + ServerAddress: "smtp.example.com", + ServerPort: 587, + FromAddress: "noreply@example.com", + FromAddressPassword: "", + FromName: "Handmade Network Team", + + ForceToAddress: "localdev@example.com", // NOTE(asaf): If this is not empty, all emails will be sent to this address. }, DigitalOcean: DigitalOceanConfig{ AssetsSpacesKey: "dummy", diff --git a/src/config/types.go b/src/config/types.go index 01f12d2..2235476 100644 --- a/src/config/types.go +++ b/src/config/types.go @@ -60,12 +60,12 @@ type DigitalOceanConfig struct { } type EmailConfig struct { - ServerAddress string - ServerPort int - FromAddress string - FromAddressPassword string - FromName string - OverrideRecipientEmail string + ServerAddress string + ServerPort int + FromAddress string + FromAddressPassword string + FromName string + ForceToAddress string } type DiscordConfig struct { diff --git a/src/email/email.go b/src/email/email.go index 560e7d6..8025b33 100644 --- a/src/email/email.go +++ b/src/email/email.go @@ -106,8 +106,8 @@ func renderTemplate(name string, data interface{}) (string, error) { } func sendMail(toAddress, toName, subject, contentHtml string) error { - if config.Config.Email.OverrideRecipientEmail != "" { - toAddress = config.Config.Email.OverrideRecipientEmail + if config.Config.Email.ForceToAddress != "" { + toAddress = config.Config.Email.ForceToAddress } contents := prepMailContents( makeHeaderAddress(toAddress, toName), -- 2.25.1