diff --git a/myteamwallet_backend/nest-cli.json b/myteamwallet_backend/nest-cli.json index 960099e..8af2a25 100644 --- a/myteamwallet_backend/nest-cli.json +++ b/myteamwallet_backend/nest-cli.json @@ -3,6 +3,6 @@ "collection": "@nestjs/schematics", "sourceRoot": "src", "compilerOptions": { - "assets": [{ "include": "i18n/**/*", "watchAssets": true }] + "assets": [{ "include": "mail/mail-templates/**/*.hbs", "watchAssets": true }] } } diff --git a/myteamwallet_backend/src/mail/mail-config.service.ts b/myteamwallet_backend/src/mail/mail-config.service.ts index acec8db..9f7b816 100644 --- a/myteamwallet_backend/src/mail/mail-config.service.ts +++ b/myteamwallet_backend/src/mail/mail-config.service.ts @@ -11,12 +11,10 @@ export class MailConfigService implements MailerOptionsFactory { constructor(private configService: ConfigService) {} createMailerOptions(): MailerOptions { - const templatesDir = path.join( - this.configService.get('app.workingDirectory'), - 'src', - 'mail', - 'mail-templates', - ); + // __dirname resolves to src/mail in dev (ts-node) and dist/mail in the + // built image, so this stays correct without depending on whether the + // process was started from a source or compiled checkout. + const templatesDir = path.join(__dirname, 'mail-templates'); handlebars.registerPartial( 'layout',