[Restore from backup: vip-coordinator-backup-2025-06-07-18-32-production-setup-complete]
23 lines
511 B
TypeScript
23 lines
511 B
TypeScript
import { Pool } from 'pg';
|
|
import dotenv from 'dotenv';
|
|
|
|
dotenv.config();
|
|
|
|
const pool = new Pool({
|
|
connectionString: process.env.DATABASE_URL || 'postgresql://postgres:changeme@localhost:5432/vip_coordinator',
|
|
max: 20,
|
|
idleTimeoutMillis: 30000,
|
|
connectionTimeoutMillis: 2000,
|
|
});
|
|
|
|
// Test the connection
|
|
pool.on('connect', () => {
|
|
console.log('✅ Connected to PostgreSQL database');
|
|
});
|
|
|
|
pool.on('error', (err) => {
|
|
console.error('❌ PostgreSQL connection error:', err);
|
|
});
|
|
|
|
export default pool;
|