This commit is contained in:
Andreas Knuth 2025-07-27 18:05:03 -05:00
parent 903ca7dc56
commit 2ebe6454ec
1 changed files with 8 additions and 2 deletions

View File

@ -9,14 +9,20 @@ import * as schema from './schema';
import { PG_CONNECTION } from './schema'; import { PG_CONNECTION } from './schema';
const { Pool } = pkg; const { Pool } = pkg;
@Module({ @Module({
imports: [ConfigModule], imports: [ConfigModule],
providers: [ providers: [
{ {
provide: PG_CONNECTION, provide: PG_CONNECTION,
inject: [ConfigService, WINSTON_MODULE_PROVIDER, ClsService], inject: [ConfigService, WINSTON_MODULE_PROVIDER, ClsService],
useFactory: async (configService: ConfigService, logger: Logger, cls: ClsService) => { useFactory: async (configService: ConfigService, logger: Logger, cls: ClsService) => {
const connectionString = configService.get<string>('DATABASE_URL'); const connectionString = configService.get<string>('DATABASE_URL');
console.log('--->',connectionString) const dbHost = configService.get<string>('DB_HOST');
const dbPort = configService.get<string>('DB_PORT');
const dbName = configService.get<string>('DB_NAME');
const dbUser = configService.get<string>('DB_USER');
const dbPassword = configService.get<string>('DB_PASSWORD');
logger.info(`Drizzle Connection - URL: ${connectionString}, Host: ${dbHost}, Port: ${dbPort}, DB: ${dbName}, User: ${dbUser}`);
console.log(`---> Drizzle Connection - URL: ${connectionString}, Host: ${dbHost}, Port: ${dbPort}, DB: ${dbName}, User: ${dbUser}`);
const pool = new Pool({ const pool = new Pool({
connectionString, connectionString,
// ssl: true, // Falls benötigt // ssl: true, // Falls benötigt