27 lines
811 B
TypeScript
27 lines
811 B
TypeScript
import { Module } from '@nestjs/common';
|
|
import { JwtModule } from '@nestjs/jwt';
|
|
import { PassportModule } from '@nestjs/passport';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { AuthService } from './auth.service';
|
|
import { AuthController } from './auth.controller';
|
|
import { JwtStrategy } from './jwt.strategy';
|
|
import { TenantModule } from '../tenant/tenant.module';
|
|
|
|
@Module({
|
|
imports: [
|
|
PassportModule,
|
|
TenantModule,
|
|
JwtModule.registerAsync({
|
|
inject: [ConfigService],
|
|
useFactory: (config: ConfigService) => ({
|
|
secret: config.get<string>('JWT_SECRET', 'devsecret'),
|
|
signOptions: { expiresIn: '24h' },
|
|
}),
|
|
}),
|
|
],
|
|
providers: [AuthService, JwtStrategy],
|
|
controllers: [AuthController],
|
|
exports: [AuthService],
|
|
})
|
|
export class AuthModule {}
|