Browse Source

Fix: One env var was different from Maily-Form

pull/1/head
Jan-Lukas Else 4 years ago
parent
commit
072cf11f8e
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      config.go
  2. +1
    -1
      config_test.go
  3. +1
    -1
      mail_test.go

+ 1
- 1
config.go View File

@ -8,7 +8,7 @@ import (
type config struct { type config struct {
Port int `env:"PORT" envDefault:"8080"` Port int `env:"PORT" envDefault:"8080"`
HoneyPots []string `env:"HONEYPOTS" envDefault:"_t_email" envSeparator:","` HoneyPots []string `env:"HONEYPOTS" envDefault:"_t_email" envSeparator:","`
DefaultRecipient string `env:"DEFAULT_TO"`
DefaultRecipient string `env:"EMAIL_TO"`
AllowedRecipients []string `env:"ALLOWED_TO" envSeparator:","` AllowedRecipients []string `env:"ALLOWED_TO" envSeparator:","`
Sender string `env:"EMAIL_FROM"` Sender string `env:"EMAIL_FROM"`
SmtpUser string `env:"SMTP_USER"` SmtpUser string `env:"SMTP_USER"`


+ 1
- 1
config_test.go View File

@ -28,7 +28,7 @@ func Test_parseConfig(t *testing.T) {
os.Clearenv() os.Clearenv()
_ = os.Setenv("PORT", "1111") _ = os.Setenv("PORT", "1111")
_ = os.Setenv("HONEYPOTS", "pot,abc") _ = os.Setenv("HONEYPOTS", "pot,abc")
_ = os.Setenv("DEFAULT_TO", "mail@example.com")
_ = os.Setenv("EMAIL_TO", "mail@example.com")
_ = os.Setenv("ALLOWED_TO", "mail@example.com,test@example.com") _ = os.Setenv("ALLOWED_TO", "mail@example.com,test@example.com")
_ = os.Setenv("EMAIL_FROM", "forms@example.com") _ = os.Setenv("EMAIL_FROM", "forms@example.com")
_ = os.Setenv("SMTP_USER", "test@example.com") _ = os.Setenv("SMTP_USER", "test@example.com")


+ 1
- 1
mail_test.go View File

@ -12,7 +12,7 @@ func Test_findRecipient(t *testing.T) {
prepare := func() { prepare := func() {
os.Clearenv() os.Clearenv()
_ = os.Setenv("ALLOWED_TO", "mail@example.com,test@example.com") _ = os.Setenv("ALLOWED_TO", "mail@example.com,test@example.com")
_ = os.Setenv("DEFAULT_TO", "mail@example.com")
_ = os.Setenv("EMAIL_TO", "mail@example.com")
appConfig, _ = parseConfig() appConfig, _ = parseConfig()
} }
t.Run("No recipient specified", func(t *testing.T) { t.Run("No recipient specified", func(t *testing.T) {


Loading…
Cancel
Save