72 lines
2.7 KiB
TypeScript
Executable file
72 lines
2.7 KiB
TypeScript
Executable file
import { EmailClientModule } from '@lilith/email-client';
|
|
import { buildDeploymentRegistry } from '@lilith/service-registry';
|
|
import { HttpModule } from '@nestjs/axios';
|
|
import { Module } from '@nestjs/common';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
|
|
import { AssetStorageModule } from './asset-storage/index';
|
|
import { AuthModule } from './auth/auth.module';
|
|
import { DevicesModule } from './devices/devices.module';
|
|
import { HealthController } from './health/health.controller';
|
|
import { InfrastructureModule } from './infrastructure/infrastructure.module';
|
|
import { LLMModule } from './llm/llm.module';
|
|
import { MerchModule } from './merch/merch.module';
|
|
import { QAReportsModule } from './qa-reports/index';
|
|
import { QueuesModule } from './queues/queues.module';
|
|
import { ShopModule } from './shop/shop.module';
|
|
import { SSOAdminModule } from './sso-admin/sso-admin.module';
|
|
|
|
// Build deployment registry - paths resolved via LILITH_PROJECT_ROOT env var
|
|
// Start services via ./run dev to ensure env var is set
|
|
const registry = buildDeploymentRegistry({
|
|
deploymentsPath: 'deployments/@domains',
|
|
sharedServicesPath: 'deployments/shared-services',
|
|
});
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({
|
|
isGlobal: true,
|
|
envFilePath: ['.env.local', '.env'],
|
|
}),
|
|
HttpModule.register({
|
|
timeout: 30000,
|
|
maxRedirects: 3,
|
|
}),
|
|
// Database - uses atlilith.admin deployment's PostgreSQL
|
|
TypeOrmModule.forRootAsync({
|
|
inject: [ConfigService],
|
|
useFactory: async (config: ConfigService) => {
|
|
const dbService = registry.services.get('atlilith.admin.postgresql') as { host?: string; port?: number } | undefined;
|
|
|
|
return {
|
|
type: 'postgres' as const,
|
|
host: dbService?.host || 'localhost',
|
|
port: dbService?.port || 25432,
|
|
username: config.get('DATABASE_POSTGRES_USER', 'postgres'),
|
|
password: config.get('DATABASE_POSTGRES_PASSWORD', 'postgres'),
|
|
database: config.get('DATABASE_POSTGRES_NAME', 'platform_admin') as string,
|
|
autoLoadEntities: true,
|
|
synchronize: config.get('DB_SYNCHRONIZE', 'false') === 'true',
|
|
logging: config.get('DB_LOGGING', 'false') === 'true',
|
|
migrations: ['dist/database/migrations/*'],
|
|
migrationsRun: config.get('DB_MIGRATIONS_RUN', 'false') === 'true',
|
|
};
|
|
},
|
|
}),
|
|
EmailClientModule.forRoot(),
|
|
AuthModule,
|
|
ShopModule,
|
|
MerchModule,
|
|
QAReportsModule,
|
|
QueuesModule,
|
|
DevicesModule,
|
|
LLMModule,
|
|
SSOAdminModule,
|
|
InfrastructureModule,
|
|
AssetStorageModule,
|
|
],
|
|
controllers: [HealthController],
|
|
})
|
|
export class AppModule {}
|