API: Add env var to opt-out mailer setup verification (#13924)

* Add env var to opt-out mailer setup verification

* Add documentation
This commit is contained in:
José Varela
2022-06-16 14:15:23 +01:00
committed by GitHub
parent 9898175f28
commit 0f438ef3d0
3 changed files with 32 additions and 27 deletions

View File

@@ -36,12 +36,14 @@ export class MailService {
this.knex = opts?.knex || getDatabase();
this.mailer = getMailer();
this.mailer.verify((error) => {
if (error) {
logger.warn(`Email connection failed:`);
logger.warn(error);
}
});
if (env.EMAIL_VERIFY_SETUP) {
this.mailer.verify((error) => {
if (error) {
logger.warn(`Email connection failed:`);
logger.warn(error);
}
});
}
}
async send(options: EmailOptions): Promise<void> {