22 lines
661 B
TypeScript
22 lines
661 B
TypeScript
import { Module } from '@nestjs/common';
|
|
import { JwtModule } from '@nestjs/jwt';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
import { JwtStrategy } from './jwt.strategy';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule,
|
|
JwtModule.registerAsync({
|
|
imports: [ConfigModule],
|
|
useFactory: async (configService: ConfigService) => ({
|
|
secret: configService.get<string>('JWT_SECRET'),
|
|
signOptions: { expiresIn: configService.get<string>('JWT_EXPIRES_IN', '3600s') },
|
|
}),
|
|
inject: [ConfigService],
|
|
}),
|
|
],
|
|
providers: [JwtStrategy],
|
|
exports: [JwtModule],
|
|
})
|
|
export class JwtAuthModule {}
|