Skip to content

Commit

Permalink
Allow password option to be non-enumerable
Browse files Browse the repository at this point in the history
to avoid breaking uses like `new Pool(existingPool.options)`.
  • Loading branch information
charmander committed Jan 13, 2020
1 parent fa1d44a commit 410b89b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/pg-pool/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,13 @@ class Pool extends EventEmitter {
super()
this.options = Object.assign({}, options)

if ('password' in this.options) {
const password = this.options.password
if (options != null && 'password' in options) {
// "hiding" the password so it doesn't show up in stack traces
// or if the client is console.logged
Object.defineProperty(this.options, 'password', {
configurable: true,
enumerable: false,
value: password,
value: options.password,
writable: true
})
}
Expand Down

0 comments on commit 410b89b

Please sign in to comment.