Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Commit 5305c55

Browse files
michaelbaudinomsakrejda
authored andcommitted
Make PGSSLMODE overrideable
All `PG*` environment variables can be overridden when using `pg:pull` or `pg:push` since #97, except `PGSSLMODE`, probably because there was no obvious use case to let users decide to insecurely bypass SSL. But when using a PostgreSQL server in Docker Comnpose using the official Postgres image, it's usually hosted on a different container than the user app and can be reached through Docker virtual network, and thus (rightously) considered remote. Unfortunately, the official Postgres image does not support SSL. It seems like a use case where it is safe to bypass SSL, even though the server is considered remote. And it might be a growing use case since even the official Postgres image do not intend to support SSL: docker-library/postgres#152 Thus I'd love to be able to use `pg:pull` from my app container to load a database in a PG server in another container 😍
1 parent b5c365f commit 5305c55

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/bastion.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ exports.getBastion = getBastion
2626

2727
const env = function (db) {
2828
let baseEnv = Object.assign({
29-
PGAPPNAME: 'psql non-interactive'
30-
}, process.env, {
31-
PGSSLMODE: (!db.hostname || db.hostname === 'localhost') ? 'prefer' : 'require'
32-
})
29+
PGAPPNAME: 'psql non-interactive',
30+
PGSSLMODE: (!db.hostname || db.hostname === 'localhost') ? 'prefer' : 'require',
31+
}, process.env)
3332
let mapping = {
3433
PGUSER: 'user',
3534
PGPASSWORD: 'password',

0 commit comments

Comments
 (0)