Skip to content

Commit 0eff017

Browse files
committed
Handle disable and false sslmode url strings - fixes porsager#177
1 parent ae6c350 commit 0eff017

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ function parseOptions(a, b) {
557557
pass : o.pass || o.password || auth[1] || env.PGPASSWORD || '',
558558
max : o.max || url.query.max || 10,
559559
types : o.types || {},
560-
ssl : o.ssl || url.query.sslmode || url.query.ssl || false,
560+
ssl : o.ssl || parseSSL(url.query.sslmode || url.query.ssl) || false,
561561
idle_timeout : o.idle_timeout || url.query.idle_timeout || env.PGIDLE_TIMEOUT || warn(o.timeout),
562562
connect_timeout : o.connect_timeout || url.query.connect_timeout || env.PGCONNECT_TIMEOUT || 30,
563563
prepare : 'prepare' in o ? o.prepare : 'no_prepare' in o ? !o.no_prepare : true,
@@ -572,6 +572,10 @@ function parseOptions(a, b) {
572572
)
573573
}
574574

575+
function parseSSL(x) {
576+
return x !== 'disabled' && x !== 'false' && x
577+
}
578+
575579
function parseUrl(url) {
576580
if (typeof url !== 'string')
577581
return { url: { query: {} } }

0 commit comments

Comments
 (0)