32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { PersonaService } from './persona.service';
|
|
import { PersonaController } from './persona.controller';
|
|
import { PassportModule } from '@nestjs/passport';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
import { Persona } from './entities/persona.entity';
|
|
import { JwtModule } from '@nestjs/jwt';
|
|
import { GoogleStrategy } from './google.strategy';
|
|
import { JwtStrategy } from './jwt.strategy';
|
|
|
|
@Module({
|
|
imports: [
|
|
TypeOrmModule.forFeature([Persona]),
|
|
PassportModule.register({ defaultStrategy: 'jwt' }),
|
|
JwtModule.registerAsync({
|
|
imports: [ConfigModule],
|
|
inject: [ConfigService],
|
|
useFactory: async (configService: ConfigService) => {
|
|
return {
|
|
global: true,
|
|
secret: configService.get<string>('JWT_SECRET'),
|
|
signOptions: { expiresIn: '1h' },
|
|
};
|
|
},
|
|
}),
|
|
],
|
|
controllers: [PersonaController, JwtStrategy],
|
|
providers: [PersonaService, GoogleStrategy],
|
|
})
|
|
export class PersonaModule {}
|