opengb
opengb copied to clipboard
Fork node-postgres to add option to force pg-cloudflare
Motivation
Currently, we depend on node-postgres automagically detecting the Cloudflare runtime by:
- Defining the user agent in esbuild: https://github.com/cloudflare/workers-sdk/blob/e8997b879605fb2eabc3e241086feb7aa219ef03/packages/wrangler/src/deployment-bundle/bundle.ts#L306
- Reading the defined user agent: https://github.com/brianc/node-postgres/blob/50c06f9bc6ff2ca1e8d7b7268b9af54ce49d72c1/packages/pg/lib/stream.js#L60
Implementation
We shouldn't have to force our user agent to Cloudflare. We should allow passing in a string forcing it to use pg-cloudflare.