Initialize mailer only if enabled

This commit is contained in:
Piotr Kozimor 2021-09-08 12:35:11 +02:00
parent 61b2c1e5c7
commit 6ccccaa373

View file

@ -47,9 +47,12 @@ func NewInternalAPI(
if err != nil {
logrus.WithError(err).Panicf("failed to connect to threepid db")
}
mailer, err := mail.NewMailer(cfg)
if err != nil {
logrus.WithError(err).Panicf("failed to crate Mailer")
var mailer mail.Mailer
if cfg.Email.Enabled {
mailer, err = mail.NewMailer(cfg)
if err != nil {
logrus.WithError(err).Panicf("failed to crate Mailer")
}
}
return &internal.UserInternalAPI{
AccountDB: accountDB,