Skip to content

Commit 4502d1c

Browse files
author
Ryan Sundberg
committed
Fix 'Error: invalid sslmode value: "true"' in native mode
When using PGSSLMODE env in native mode, an invalid database URL string would be constructed with sslmode=true/false.
1 parent 1b022f8 commit 4502d1c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/pg/lib/connection-parameters.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ class ConnectionParameters {
123123
add(params, this, 'connect_timeout')
124124
add(params, this, 'options')
125125

126-
var ssl = typeof this.ssl === 'object' ? this.ssl : this.ssl ? { sslmode: this.ssl } : {}
126+
var ssl = (typeof this.ssl === 'object')
127+
? this.ssl
128+
: ((this.ssl && typeof this.ssl === 'string')
129+
? { sslmode: this.ssl }
130+
: {})
127131
add(params, ssl, 'sslmode')
128132
add(params, ssl, 'sslca')
129133
add(params, ssl, 'sslkey')

0 commit comments

Comments
 (0)