69 lines
2.5 KiB
TypeScript
Executable file
69 lines
2.5 KiB
TypeScript
Executable file
// BotDefenseModule temporarily removed: bun creates per-workspace copies of
|
|
// @nestjs/typeorm with different content-addressable hashes, causing NestJS
|
|
// DataSource injection to fail across workspace boundaries.
|
|
// TODO: Re-enable when bun dedup issue is resolved or bot-defense is published
|
|
// import { BotDefenseModule } from "@features/bot-defense-backend-api";
|
|
import { getServiceRegistry } from "@lilith/service-registry";
|
|
import { BullModule } from "@nestjs/bullmq";
|
|
import { Module } from "@nestjs/common";
|
|
import { ConfigModule } from "@nestjs/config";
|
|
import { ScheduleModule } from "@nestjs/schedule";
|
|
|
|
import { DomainEventsModule } from "./common/domain-events";
|
|
import { EmailClientModule } from "@/common/_stubs/email-client.stub";
|
|
import { HealthCheckService } from "./common/health/health-check.service";
|
|
import { HealthController } from "./common/health/health.controller";
|
|
import { ThrottlingModule } from "./common/security/throttling";
|
|
import { AdminModule } from "./features/admin/admin.module";
|
|
import { AuthModule } from "./features/auth/auth.module";
|
|
import { MfaModule } from "./features/mfa/mfa.module";
|
|
import { SessionsModule } from "./features/sessions/sessions.module";
|
|
import { SettingsModule } from "./features/settings/settings.module";
|
|
import { UsersModule } from "./features/users/users.module";
|
|
import { UIController } from "./ui/ui.controller";
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({
|
|
isGlobal: true,
|
|
envFilePath: ".env",
|
|
}),
|
|
// Redis queue - uses sso shared service's Redis
|
|
BullModule.forRootAsync({
|
|
useFactory: async () => {
|
|
const registry = getServiceRegistry();
|
|
const redisUrl = registry.getRedisUrl('sso');
|
|
|
|
if (!redisUrl) {
|
|
throw new Error('Redis URL not found for sso service in service registry');
|
|
}
|
|
|
|
const url = new URL(redisUrl);
|
|
const host = url.hostname;
|
|
const port = parseInt(url.port || '26379', 10);
|
|
|
|
return {
|
|
connection: {
|
|
host,
|
|
port,
|
|
...(process.env.DATABASE_REDIS_PASSWORD && { password: process.env.DATABASE_REDIS_PASSWORD }),
|
|
},
|
|
};
|
|
},
|
|
}),
|
|
DomainEventsModule.forRoot(),
|
|
ScheduleModule.forRoot(),
|
|
ThrottlingModule,
|
|
EmailClientModule.forRoot(),
|
|
AuthModule,
|
|
MfaModule,
|
|
SessionsModule,
|
|
SettingsModule,
|
|
UsersModule,
|
|
AdminModule,
|
|
// BotDefenseModule, // See note above re: bun dual-instance issue
|
|
],
|
|
controllers: [UIController, HealthController],
|
|
providers: [HealthCheckService],
|
|
})
|
|
export class AppModule {}
|