deploy: notesfrais — 2026-04-29 09:57:19
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { Pool } from 'pg';
|
||||
import { config } from './config';
|
||||
|
||||
export const db = new Pool({
|
||||
connectionString: config.databaseUrl,
|
||||
ssl: config.nodeEnv === 'production' ? { rejectUnauthorized: false } : false,
|
||||
max: 10,
|
||||
});
|
||||
|
||||
db.on('error', (err) => {
|
||||
console.error('Erreur pool PostgreSQL :', err.message);
|
||||
});
|
||||
|
||||
export async function testConnection(): Promise<void> {
|
||||
const client = await db.connect();
|
||||
client.release();
|
||||
console.log('✅ PostgreSQL connecté');
|
||||
}
|
||||
Reference in New Issue
Block a user