import { drizzle } from "drizzle-orm/postgres-js"; import postgres from "postgres"; import * as schema from "./schema"; import { getEnvInt } from "@/lib/public-api/performance"; const client = postgres(process.env.POSTGRES_URL!, { connect_timeout: getEnvInt("POSTGRES_CONNECT_TIMEOUT_SECONDS", 5, 1, 60), idle_timeout: getEnvInt("POSTGRES_IDLE_TIMEOUT_SECONDS", 20, 1, 300), max: getEnvInt("POSTGRES_MAX_CONNECTIONS", 10, 1, 50), prepare: false, }); export const db = drizzle(client, { schema });