fix: mailer module init with right env value
This commit is contained in:
@@ -7,20 +7,19 @@ import {
|
|||||||
MAILER_FROM_ADDRESS_UNDEFINED,
|
MAILER_FROM_ADDRESS_UNDEFINED,
|
||||||
MAILER_SMTP_URL_UNDEFINED,
|
MAILER_SMTP_URL_UNDEFINED,
|
||||||
} from 'src/errors';
|
} from 'src/errors';
|
||||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
NestMailerModule.forRootAsync({
|
NestMailerModule.forRootAsync({
|
||||||
imports: [ConfigModule],
|
|
||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
useFactory: async (configService: ConfigService) => ({
|
useFactory: async (configService: ConfigService) => ({
|
||||||
transport:
|
transport:
|
||||||
configService.get('MAILER_SMTP_URL') ??
|
configService.get('INFRA.MAILER_SMTP_URL') ??
|
||||||
throwErr(MAILER_SMTP_URL_UNDEFINED),
|
throwErr(MAILER_SMTP_URL_UNDEFINED),
|
||||||
defaults: {
|
defaults: {
|
||||||
from:
|
from:
|
||||||
configService.get('MAILER_ADDRESS_FROM') ??
|
configService.get('INFRA.MAILER_ADDRESS_FROM') ??
|
||||||
throwErr(MAILER_FROM_ADDRESS_UNDEFINED),
|
throwErr(MAILER_FROM_ADDRESS_UNDEFINED),
|
||||||
},
|
},
|
||||||
template: {
|
template: {
|
||||||
|
|||||||
Reference in New Issue
Block a user