Files
pcpuma_unam_api/src/auth/auth.module.ts
T

34 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-04-21 16:31:26 -05:00
import { ConfigService } from '@nestjs/config';
import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { PassportModule } from '@nestjs/passport';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
2022-04-21 20:33:05 -05:00
import { BcryptModule } from '../bcrypt/bcrypt.module';
2022-04-21 16:31:26 -05:00
import { JwtStrategyService } from './strategy/jwt-strategy.service';
2022-04-21 21:52:40 -05:00
import { ModuloModule } from '../modulo/modulo.module';
2022-04-21 20:33:05 -05:00
import { OperadorModule } from '../operador/operador.module';
import { UsuarioModule } from '../usuario/usuario.module';
2022-04-21 16:31:26 -05:00
@Module({
imports: [
PassportModule.register({ defaultStrategy: 'jwt' }),
JwtModule.registerAsync({
inject: [ConfigService],
useFactory: (configService: ConfigService) => {
return {
secret: configService.get<string>('AUTH_SECRETKEY'),
2022-05-02 15:29:13 -05:00
signOptions: { expiresIn: '2h' },
2022-04-21 16:31:26 -05:00
};
},
}),
2022-04-21 20:33:05 -05:00
BcryptModule,
2022-04-21 21:52:40 -05:00
ModuloModule,
2022-04-21 20:33:05 -05:00
OperadorModule,
UsuarioModule,
2022-04-21 16:31:26 -05:00
],
controllers: [AuthController],
providers: [AuthService, JwtStrategyService],
})
export class AuthModule {}