smtp: if disabled, bail out before loading templates

Signed-off-by: crabique <crabique@users.noreply.github.com>
This commit is contained in:
crabique 2024-02-26 17:12:22 +02:00
parent 12f599fd65
commit a93ebe36c8

View file

@ -248,7 +248,7 @@ func (c *Config) loadTemplates(configDir string) error {
return nil
}
// Initialize initialized and validates the SMTP configuration
// Initialize initializes and validates the SMTP configuration
func (c *Config) Initialize(configDir string, isService bool) error {
if !isService && c.Host == "" {
if err := loadConfigFromProvider(); err != nil {
@ -259,12 +259,12 @@ func (c *Config) Initialize(configDir string, isService bool) error {
}
return c.loadTemplates(configDir)
}
if err := c.loadTemplates(configDir); err != nil {
return err
}
if c.Host == "" {
return loadConfigFromProvider()
}
if err := c.loadTemplates(configDir); err != nil {
return err
}
if err := c.validate(); err != nil {
return err
}