45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { AccountModule } from './account/account.module';
|
|
import { AppController } from './app.controller';
|
|
import { AppService } from './app.service';
|
|
import { env } from './config/env';
|
|
import { LdapModule } from './ldap/ldap.module';
|
|
import { LdapTfaModule } from './ldap-tfa/ldap-tfa.module';
|
|
import { CacheModule } from '@nestjs/cache-manager';
|
|
import { Global, Module } from '@nestjs/common';
|
|
import { ConfigModule } from '@nestjs/config';
|
|
import { JwtModule } from '@nestjs/jwt';
|
|
import { MongooseModule } from '@nestjs/mongoose';
|
|
import * as redisStore from 'cache-manager-ioredis';
|
|
import type { RedisOptions } from 'ioredis';
|
|
|
|
@Global()
|
|
@Module({
|
|
controllers: [AppController],
|
|
exports: [JwtModule],
|
|
imports: [
|
|
ConfigModule.forRoot({
|
|
isGlobal: true,
|
|
}),
|
|
JwtModule.register({
|
|
secret: env.API_SECRET,
|
|
signOptions: {
|
|
expiresIn: env.API_TOKEN_TTL,
|
|
},
|
|
}),
|
|
LdapModule,
|
|
AccountModule,
|
|
LdapTfaModule,
|
|
MongooseModule.forRoot(`mongodb://${env.MONGO_HOST}`),
|
|
CacheModule.register<RedisOptions>({
|
|
host: env.REDIS_HOST,
|
|
isGlobal: true,
|
|
port: env.REDIS_PORT,
|
|
store: redisStore,
|
|
ttl: env.API_CACHE_TTL,
|
|
}),
|
|
],
|
|
providers: [AppService],
|
|
})
|
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
export class AppModule {}
|