Skip to content

Commit 2e179fc

Browse files
authored
Warn about mixed use of connectionString and ssl (#130)
1 parent acc314d commit 2e179fc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

content/features/6-ssl.mdx

+15
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,18 @@ pool
4444
.catch(err => console.error('error connecting', err.stack))
4545
.then(() => pool.end())
4646
```
47+
48+
## Usage with `connectionString`
49+
50+
If you plan to use a combination of a database connection string from the environment and SSL settings in the config object directly, then you must avoid including any of `sslcert`, `sslkey`, `sslrootcert`, or `sslmode` in the connection string. If any of these options are used then the `ssl` object is replaced and any additional options provided there will be lost.
51+
52+
```js
53+
const config = {
54+
connectionString: 'postgres://user:password@host:port/db?sslmode=require',
55+
// Beware! The ssl object is overwritten when parsing the connectionString
56+
ssl: {
57+
rejectUnauthorized: false,
58+
ca: fs.readFileSync('/path/to/server-certificates/root.crt').toString(),
59+
},
60+
}
61+
```

0 commit comments

Comments
 (0)