forked from Ynov/ptitspas-ynov-back
25 lines
764 B
TypeScript
25 lines
764 B
TypeScript
import { forwardRef, Module } from '@nestjs/common';
|
|
import { AuthController } from './auth.controller';
|
|
import { AuthService } from './auth.service';
|
|
import { UserModule } from '../user/user.module';
|
|
import { JwtModule } from '@nestjs/jwt';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
|
|
@Module({
|
|
imports: [
|
|
forwardRef(() => UserModule),
|
|
JwtModule.registerAsync({
|
|
imports: [ConfigModule],
|
|
useFactory: (config: ConfigService) => ({
|
|
secret: config.get('jwt.secret'),
|
|
signOptions: { expiresIn: config.get('jwt.expirationTime') },
|
|
}),
|
|
inject: [ConfigService],
|
|
})
|
|
],
|
|
controllers: [AuthController],
|
|
providers: [AuthService],
|
|
exports: [AuthService, JwtModule],
|
|
})
|
|
export class AuthModule {}
|