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.
33 lines
1.0 KiB
33 lines
1.0 KiB
import { Global, Module } from '@nestjs/common';
|
|
import { AuthService } from './auth.service';
|
|
import { UserModule } from '../../user/user.module';
|
|
import { PassportModule } from '@nestjs/passport';
|
|
import { JwtModule, JwtModuleOptions } from '@nestjs/jwt';
|
|
import { ConfigModule } from '../config/config.module';
|
|
import { ConfigService } from '../config/config.service';
|
|
import { JwtStrategy } from './jwt.strategy';
|
|
import { AuthController } from './auth.controller';
|
|
|
|
@Global()
|
|
@Module({
|
|
imports: [
|
|
UserModule,
|
|
// ConfigModule,
|
|
PassportModule.register({ defaultStrategy: 'jwt' }),
|
|
JwtModule.registerAsync({
|
|
imports: [ConfigModule],
|
|
inject: [ConfigService],
|
|
useFactory: async (
|
|
configService: ConfigService,
|
|
): Promise<JwtModuleOptions> => ({
|
|
secretOrPrivateKey: configService.jwtSecret,
|
|
signOptions: {
|
|
expiresIn: 3600,
|
|
},
|
|
}),
|
|
}),
|
|
],
|
|
providers: [AuthService, JwtStrategy],
|
|
controllers: [AuthController],
|
|
})
|
|
export class AuthModule {}
|