You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.6 KiB

import { Module } from "@nestjs/common";
import { UsersModule } from "src/users/users.module";
import { PassportModule } from "@nestjs/passport";
import { ConfigModule, ConfigService } from "@nestjs/config";
import { AuthController } from "./auth.controller";
import { FtStrategy } from "./42.strategy";
import { SessionSerializer } from "./session.serializer";
import { JwtModule } from "@nestjs/jwt";
import { MailerModule } from "@nestjs-modules/mailer";
import { AuthService } from "./auth.service";
import { HandlebarsAdapter } from "@nestjs-modules/mailer/dist/adapters/handlebars.adapter";
2 years ago
const mailUser =
process.env.MAIL_USER !== null && process.env.MAIL_USER !== ""
2 years ago
? process.env.MAIL_USER
: "";
const mailPass =
process.env.MAIL_PASSWORD !== null && process.env.MAIL_PASSWORD !== ""
2 years ago
? process.env.MAIL_PASSWORD
: "";
@Module({
2 years ago
imports: [
UsersModule,
PassportModule,
ConfigModule.forRoot(),
JwtModule.register({
secret: process.env.JWT_SECRET,
signOptions: { expiresIn: "60s" },
2 years ago
}),
MailerModule.forRoot({
transport: {
service: "gmail",
2 years ago
auth: {
user: mailUser,
pass: mailPass,
},
2 years ago
},
template: {
dir: "src/auth/mails",
2 years ago
adapter: new HandlebarsAdapter(),
options: {
strict: true,
},
2 years ago
},
defaults: {
from: '"No Reply" vaganiwast@gmail.com',
},
}),
2 years ago
],
providers: [ConfigService, FtStrategy, SessionSerializer, AuthService],
controllers: [AuthController],
})
export class AuthModule {}