pg-ssl

JSON →
library 0.0.1 ·javascript
verified Jun 5, 2026

A utility for parsing libpq-style environment variables into SSL configuration for node-postgres (pg). As of v0.0.1, it bridges a gap where node-postgres ignores SSL-related environment variables like PGSSLMODE, PGSSLROOTCERT, PGSSLCERT, and PGSSLKEY. It reads these env vars to produce the `ssl` object expected by `new Pool()`, including ca, cert, key, and rejectUnauthorized. Supports custom overrides, servername for SNI, and checkServerIdentity callback. Particularly useful for cloud SQL connections (e.g., Google Cloud SQL, AWS RDS) that require certificate-based TLS. Lightweight, no dependencies, and works with both ESM and CJS.