Spaces:
Runtime error
Runtime error
File size: 540 Bytes
4782147 f4a29d0 4782147 fe2523c f4a29d0 fe2523c f4a29d0 fe2523c f4a29d0 4782147 f4a29d0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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, {});
|