feat(mail): add MailSender port and explicit provider selection
This commit is contained in:
1 parent
e7d0d92ef9
commit
6153887eb5
26 files changed
+1253
-29
No files matched your search
@@ -41,9 +41,24 @@ type Config struct {
|
||||
SeaweedFSRegion string
|
||||
SeaweedFSTimeout time.Duration
|
||||
KafkaBrokers []string
|
||||
LogLevel string
|
||||
ReadinessTimeout time.Duration
|
||||
ShutdownTimeout time.Duration
|
||||
// EmailProvider selects the only active mail transport. Settings of the
|
||||
// other transports are not loaded.
|
||||
EmailProvider EmailProvider
|
||||
// EmailFrom is the sender mailbox for every outgoing message.
|
||||
EmailFrom string
|
||||
EmailTimeout time.Duration
|
||||
// AppPublicURL is the public origin without a trailing slash, for links
|
||||
// in mail.
|
||||
AppPublicURL string
|
||||
ResendAPIKey string
|
||||
SMTPHost string
|
||||
SMTPPort int
|
||||
SMTPUsername string
|
||||
SMTPPassword string
|
||||
SMTPTLSMode SMTPTLSMode
|
||||
LogLevel string
|
||||
ReadinessTimeout time.Duration
|
||||
ShutdownTimeout time.Duration
|
||||
}
|
||||
|
||||
type LookupEnv func(string) (string, bool)
|
||||
@@ -75,6 +90,9 @@ func LoadFromEnv(lookup LookupEnv) (Config, error) {
|
||||
if err := config.loadRedis(lookup); err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
if err := config.loadMail(lookup); err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
|
||||
var err error
|
||||
config.DatabaseMigrateOnStart, err = boolOrDefault(lookup, "DATABASE_MIGRATE_ON_START", defaultDatabaseMigrateOnStart)
|
||||
@@ -113,6 +131,9 @@ func (config Config) Validate() error {
|
||||
if err := config.ValidateKafka(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := config.ValidateMail(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateAddress("HTTP_ADDR", config.HTTPAddr); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user