33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
![]() |
import { Module } from '@nestjs/common';
|
||
|
import { JwtModule } from '@nestjs/jwt';
|
||
|
import { PassportModule } from '@nestjs/passport';
|
||
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||
|
|
||
|
import { AuthController } from './auth.controller';
|
||
|
import { AuthService } from './auth.service';
|
||
|
import { GoogleStrategy } from './google.strategy';
|
||
|
import { JwtStrategy } from './jwt.strategy';
|
||
|
import { DatabaseModule } from '../database/database.module';
|
||
|
|
||
|
@Module({
|
||
|
imports: [
|
||
|
DatabaseModule,
|
||
|
PassportModule.register({ defaultStrategy: 'jwt' }),
|
||
|
JwtModule.registerAsync({
|
||
|
imports: [ConfigModule],
|
||
|
useFactory: async (configService: ConfigService) => ({
|
||
|
secret: configService.get<string>('JWT_SECRET'),
|
||
|
signOptions: {
|
||
|
expiresIn: configService.get<string>('JWT_EXPIRES_IN', '7d'),
|
||
|
issuer: 'seo-image-renamer',
|
||
|
audience: 'seo-image-renamer-users',
|
||
|
},
|
||
|
}),
|
||
|
inject: [ConfigService],
|
||
|
}),
|
||
|
],
|
||
|
controllers: [AuthController],
|
||
|
providers: [AuthService, GoogleStrategy, JwtStrategy],
|
||
|
exports: [AuthService, JwtModule],
|
||
|
})
|
||
|
export class AuthModule {}
|