Skip to content

Commit d24ca25

Browse files
authored
pg-connection-string: Support environments where node:process isn’t available (#3585)
by skipping emitting the warning. Fixes #3583.
1 parent a158f03 commit d24ca25

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

packages/pg-connection-string/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict'
22

3-
const { emitWarning } = require('process')
4-
53
//Parse method copied from https://github.com/brianc/node-postgres
64
//Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)
75
//MIT License
@@ -213,9 +211,9 @@ function parseIntoClientConfig(str) {
213211
}
214212

215213
function deprecatedSslModeWarning(sslmode) {
216-
if (!deprecatedSslModeWarning.warned) {
214+
if (!deprecatedSslModeWarning.warned && typeof process !== 'undefined' && process.emitWarning) {
217215
deprecatedSslModeWarning.warned = true
218-
emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
216+
process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
219217
In the next major version (pg-connection-string v3.0.0 and pg v9.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees.
220218
221219
To prepare for this change:

0 commit comments

Comments
 (0)