Files
edr-platform/apps/edr-passenger-api/src/config/iam-database.config.ts

19 lines
806 B
TypeScript

import { registerAs } from '@nestjs/config';
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
import { buildIamTypeOrmOptions } from '../common/iam-typeorm.config';
/**
* Dedicated config namespace for the IAM **TypeORM** connection — the shared `iam` schema ONLY.
*
* This is intentionally separate from Prisma: Prisma remains the app's primary ORM and owns the
* `passenger` schema via `DATABASE_URL` (see prisma.service.ts). This second connection exists
* solely because `@tria-plc/api-common` / `@tria-plc/iamapi-common` are TypeORM-based and the
* `JwtGuard` reads `iam.sessions` through a TypeORM `DataSource`.
*
* Consumed by `TypeOrmModule.forRootAsync` in app.module.ts.
*/
export default registerAs(
'iamDatabase',
(): TypeOrmModuleOptions => buildIamTypeOrmOptions(),
);