Add mail driver (#3205)
* Add node mailer packages * Init mailer module * Add logger transport * Use env variable to get transport * Revert "Add node mailer packages" This reverts commit 3fb954f0caef94266f96ff5f08de750073ab3491. * Add nodemailer * Use driver pattern * Use logger * Fix yarn install * Code review returns * Add configuration examples for smtp * Fix merge conflict * Add missing packages * Fix ci
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
import { Injectable, LogLevel } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
import { EmailDriver } from 'src/integrations/email/interfaces/email.interface';
|
||||
|
||||
import { LoggerDriverType } from 'src/integrations/logger/interfaces';
|
||||
import { ExceptionHandlerDriver } from 'src/integrations/exception-handler/interfaces';
|
||||
import { StorageDriverType } from 'src/integrations/file-storage/interfaces';
|
||||
@ -170,6 +172,28 @@ export class EnvironmentService {
|
||||
);
|
||||
}
|
||||
|
||||
getEmailDriver(): EmailDriver {
|
||||
return (
|
||||
this.configService.get<EmailDriver>('EMAIL_DRIVER') ?? EmailDriver.Logger
|
||||
);
|
||||
}
|
||||
|
||||
getEmailHost(): string | undefined {
|
||||
return this.configService.get<string>('EMAIL_SMTP_HOST');
|
||||
}
|
||||
|
||||
getEmailPort(): number | undefined {
|
||||
return this.configService.get<number>('EMAIL_SMTP_PORT');
|
||||
}
|
||||
|
||||
getEmailUser(): string | undefined {
|
||||
return this.configService.get<string>('EMAIL_SMTP_USER');
|
||||
}
|
||||
|
||||
getEmailPassword(): string | undefined {
|
||||
return this.configService.get<string>('EMAIL_SMTP_PASSWORD');
|
||||
}
|
||||
|
||||
getSupportDriver(): string {
|
||||
return (
|
||||
this.configService.get<string>('SUPPORT_DRIVER') ?? SupportDriver.None
|
||||
|
||||
Reference in New Issue
Block a user