prevision / apps /prevision-api /src /prisma /connection-string.ts
github-actions[bot]
Automated Deploy: 23110475c742a5d4f03930b55bca09042215c1dd
1fe7075
Raw History Blame Contribute Delete
457 Bytes
/**
* node-postgres reads `sslmode=require` as "verify the certificate"; libpq (and the
* BAETES API) only require encryption. Keep the libpq meaning so both APIs share DATABASE_URL.
*/
export function pgConnectionString(url: string): string {
const parsed = new URL(url);
if (parsed.searchParams.has('sslmode') && !parsed.searchParams.has('uselibpqcompat')) {
parsed.searchParams.set('uselibpqcompat', 'true');
}
return parsed.toString();
}