allow both connectionString and additional options#1363
allow both connectionString and additional options#1363brianc merged 1 commit intobrianc:masterfrom caub:options
Conversation
brianc left a comment
There was a problem hiding this comment.
Would you be able to include some tests for this? I can't accept a PR without tests.
.gitignore Outdated
package.json Outdated
package.json Outdated
There was a problem hiding this comment.
this needs to be exactly 4.1.1 without the ^
| Thanks @caub! Put a couple comments up there. |
| ok, I think npm5 automatically adds pg-native, since it's required in the lib/ source. And it generates that package-lock thing too I wanted to test with |
| ohhhh I bet it added it during the test run. I'll need to add some kinda parameter to the test to make it not save when doing an |
lib/connection-parameters.js Outdated
There was a problem hiding this comment.
Object.assign can be used now that pg targets Node 4.
| @charmander done, that's great to be node4+ now |
lib/connection-parameters.js Outdated
There was a problem hiding this comment.
This might be a bit too compact. Maybe:
config = typeof config === 'string' ? parse(config) : Object.assign({}, config) if (config.connectionString) { Object.assign(config, parse(config.connectionString)) }?
lib/connection-parameters.js Outdated
There was a problem hiding this comment.
I've used intermediate vars, or I can mutate if you really prefer
There was a problem hiding this comment.
I’d still suggest the same snippet as earlier, since it always copies the configuration object.
lib/connection-parameters.js Outdated
There was a problem hiding this comment.
@charmander ok done, I just check here with typeof, because parse would probably throw else
There was a problem hiding this comment.
Throwing instead of hiding potential errors is generally good, and it already behaved that way. I’d keep this check unmodified.
There was a problem hiding this comment.
Is this supposed to work? Connection strings seem to work at the client level, whereas max is at the pool level.
If it’s not, it should probably be removed to avoid misleading people.
There was a problem hiding this comment.
yes done, I need to make a similar PR for pg-pool
| Thanks so much for this! Pushing out a new minor version w/ the changes now. |
…sts with npm 5 Should save some confusion in future pull requests (brianc#1465, brianc#1436, brianc#1363).
allows
connectionString params will still override other options to stay compatible