Spaces:
Runtime error
Runtime error
Cyber Catalyst Team
Fix database connection ssl query parameters overriding rejectUnauthorized config
fe2523c | import { drizzle as drizzlePg } from "drizzle-orm/node-postgres"; | |
| import pg from "pg"; | |
| const rawConnectionString = process.env.POSTGRES_URL; | |
| if (!rawConnectionString) { | |
| console.warn("POSTGRES_URL is missing! Database connection will fail."); | |
| } | |
| // Strip query parameters like ?sslmode=require so that they don't override the ssl object | |
| const connectionString = rawConnectionString?.split("?")[0]; | |
| const pool = new pg.Pool({ | |
| connectionString, | |
| ssl: { | |
| rejectUnauthorized: false, | |
| }, | |
| }); | |
| export const pgDb = drizzlePg(pool, {}); | |