Skip to content

Commit

Permalink
fix: mailer mode dev
Browse files Browse the repository at this point in the history
  • Loading branch information
fufeck committed Aug 20, 2024
1 parent 94bed66 commit 5d8c3cb
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions libs/shared/src/params/mailer.params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,34 @@ import { join } from 'path';
export const MailerParams = {
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (config: ConfigService) => ({
transport: {
host: config.get('SMTP_HOST'),
port: config.get('SMTP_PORT'),
secure: config.get('SMTP_SECURE') === 'YES',
auth: {
user: config.get('SMTP_USER'),
pass: config.get('SMTP_PASS'),
},
},
defaults: {
from: config.get('SMTP_FROM'),
},
template: {
dir: join(__dirname, '../../../', '/email-templates'),
adapter: new HandlebarsAdapter(),
options: {
strict: true,
},
},
}),
useFactory: async (config: ConfigService) =>
config.get('SMTP_HOST')
? {
transport: {
host: config.get('SMTP_HOST'),
port: config.get('SMTP_PORT'),
secure: config.get('SMTP_SECURE') === 'YES',
auth: {
user: config.get('SMTP_USER'),
pass: config.get('SMTP_PASS'),
},
},
defaults: {
from: config.get('SMTP_FROM'),
},
template: {
dir: join(__dirname, '../../../', '/email-templates'),
adapter: new HandlebarsAdapter(),
options: {
strict: true,
},
},
}
: {
transport: {
streamTransport: true,
newline: 'unix',
buffer: true,
},
},
};

0 comments on commit 5d8c3cb

Please sign in to comment.