Skip to content

Commit

Permalink
Merge pull request #824 from dhensby/pulls/4/dont-modify-config-obj
Browse files Browse the repository at this point in the history
Dont modify the passed in config object
  • Loading branch information
willmorgan authored Mar 8, 2019
2 parents 1d31ad6 + 155c5c2 commit c4e939d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,20 @@ class ConnectionPool extends EventEmitter {
IDS.add(this, 'ConnectionPool')
debug('pool(%d): created', IDS.get(this))

this.config = config
this._connected = false
this._connecting = false

if (typeof this.config === 'string') {
if (typeof config === 'string') {
try {
this.config = ConnectionString.resolve(this.config, driver.name)
this.config = ConnectionString.resolve(config, driver.name)
} catch (ex) {
if (typeof callback === 'function') {
return callback(ex)
}
throw ex
}
} else {
this.config = Object.assign({}, config)
}

// set defaults
Expand Down

0 comments on commit c4e939d

Please sign in to comment.