Add PGSSLMODE=no-verify
support to opt-out of rejecting self-signed certs
#2195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upgrading to
pg@8
is currently quite hard if relying on environment variables to set the SSL mode. For example, on Heroku, SSL is required, but the certs are not available. A good way to set this up traditionally is to setPGSSLMODE=require
for app dynos, andPGSSLMODE=false
(or not defined) for in-dyno CI (local ephemeral test databases).However, in
pg@8
the{ rejectUnauthorized: false }
option needs to be used, so this means consumers need to update all code to be aware of the environment it's running in. This also extends to code from third parties (e.g. migration frameworks likedb-migrate
), which would need to internally set this option to continue working. All of this means it's quite hard to upgrade.A simple solution is to to support implementing a
PGSSLMODE=no-verify
option as suggested in this comment: #2009 (comment). This PR does exactly that! 👍