DB URL query params are ignored
wh4everest opened this issue · 2 comments
One way to enable SSL in pg
is to pass the flag { ssl: 'require' }
through the connection URL:
postgres://user:pass@db:5432/dbname?ssl=require
However, because connect-pg-simple
manually parses the URL, the query params are lost.
There are a few solutions that I can think of:
- Handle the
ssl
config option specifically and include it in the soon-to-be-passedconObject
(I don't like this option) - Use the parsed query params and include them all, like it's done here: https://github.com/grncdr/parse-db-url/blob/master/parse-url.js#L36
- Use the
parse-db-url
package itself. But perhaps you don't want to add a new dependency.
I'd be happy to submit a PR, just tell me which solution do you prefer?
Thanks,
Andrej
@wh4everest I like option 2, could you make a PR for it?
Also adding a good mention of that option in the README in the PR would be 👌
Sorry for not getting back to you on this one. I have now released 5.0.0
which fixes this by forwarding the connection string to the pg module itself.
Full changelog: https://github.com/voxpelli/node-connect-pg-simple/blob/master/CHANGELOG.md#500-2018-06-06