mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 14:38:19 +02:00
Configure production database connection for increased reliability
Updates the server-side database configuration to use standard PostgreSQL for production environments, ensuring a more robust and reliable connection. Previously, it might have defaulted to a different setup or encountered connection issues. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d396e5bd-e32d-4a20-9e7d-71e7102ddc6c Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/d396e5bd-e32d-4a20-9e7d-71e7102ddc6c/CrwFq15
This commit is contained in:
1 parent
2aecaa2672
commit
22a6c5d7f6
6 files changed
+305
-15
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { Pool } from 'pg';
|
||||
import { drizzle } from 'drizzle-orm/node-postgres';
|
||||
import * as schema from "@shared/schema";
|
||||
|
||||
console.log('🐳 PRODUCTION: Configuring standard PostgreSQL database');
|
||||
|
||||
if (!process.env.DATABASE_URL) {
|
||||
throw new Error("DATABASE_URL must be set for production");
|
||||
}
|
||||
|
||||
// Log connection details (without password)
|
||||
const dbUrl = new URL(process.env.DATABASE_URL);
|
||||
console.log('🐳 Database connection:', {
|
||||
host: dbUrl.hostname,
|
||||
port: dbUrl.port,
|
||||
database: dbUrl.pathname.slice(1),
|
||||
user: dbUrl.username
|
||||
});
|
||||
|
||||
export const pool = new Pool({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
ssl: false, // No SSL for local Docker
|
||||
max: 20,
|
||||
idleTimeoutMillis: 30000,
|
||||
connectionTimeoutMillis: 10000,
|
||||
});
|
||||
|
||||
export const db = drizzle({ client: pool, schema });
|
||||
|
||||
// Test connection
|
||||
pool.on('connect', () => {
|
||||
console.log('✅ PostgreSQL connection established');
|
||||
});
|
||||
|
||||
pool.on('error', (err) => {
|
||||
console.error('❌ PostgreSQL connection error:', err);
|
||||
});
|
||||
|
||||
console.log('✅ Production PostgreSQL database configured');
|
||||
Reference in new issue
Block a user