Skip to content

Commit a3afacc

Browse files
committed
Avoid creating “password” property on pool options
when it didn’t exist previously.
1 parent 5a2033f commit a3afacc

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

packages/pg-pool/index.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,19 @@ class Pool extends EventEmitter {
6060
constructor (options, Client) {
6161
super()
6262
this.options = Object.assign({}, options)
63-
const password = this.options.password
64-
// "hiding" the password so it doesn't show up in stack traces
65-
// or if the client is console.logged
66-
Object.defineProperty(this.options, 'password', {
67-
configurable: true,
68-
enumerable: false,
69-
value: password,
70-
writable: true
71-
})
63+
64+
if ('password' in this.options) {
65+
const password = this.options.password
66+
// "hiding" the password so it doesn't show up in stack traces
67+
// or if the client is console.logged
68+
Object.defineProperty(this.options, 'password', {
69+
configurable: true,
70+
enumerable: false,
71+
value: password,
72+
writable: true
73+
})
74+
}
75+
7276
this.options.max = this.options.max || this.options.poolSize || 10
7377
this.log = this.options.log || function () { }
7478
this.Client = this.options.Client || Client || require('pg').Client

0 commit comments

Comments
 (0)