25 lines
741 B
TypeScript
25 lines
741 B
TypeScript
import { Module } from '@nestjs/common';
|
|||
|
|
import { JwtModule } from '@nestjs/jwt';
|
||
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||
|
|
import { AuthService } from './auth.service';
|
||
|
|
import { AuthController } from './auth.controller';
|
||
|
|
|
||
|
|
@Module({
|
||
|
|
imports: [
|
||
|
|
JwtModule.registerAsync({
|
||
|
|
imports: [ConfigModule],
|
||
|
|
inject: [ConfigService],
|
||
|
|
useFactory: (config: ConfigService) => ({
|
||
|
|
secret: config.get<string>('JWT_SECRET', 'fabric-trade-dev-secret'),
|
||
|
|
signOptions: {
|
||
|
|
expiresIn: config.get('JWT_EXPIRES_IN', '7d') as `${number}d`,
|
||
|
|
},
|
||
|
|
}),
|
||
|
|
}),
|
||
|
|
],
|
||
|
|
controllers: [AuthController],
|
||
|
|
providers: [AuthService],
|
||
|
|
exports: [AuthService, JwtModule],
|
||
|
|
})
|
||
|
|
export class AuthModule {}
|