-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Accept connection parameters in Pool constructor #1068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hey @0x8890 thanks for the PR, I really appreciate the work! Question: is there a particular use case that is disabled by not using connection parameters? I'd like to understand a bit better what's missing & hopefully get a test up around it so a regression is not introduced in another change in the future. |
@brianc yes, I would like to use a connection string instead of a configuration object to instantiate a Pool. There does not seem to be any public API for parsing a connection string exposed by this library, and it would also be convenient to accept a connection string here. I have written an interface that makes use of the connection string, and currently it's not possible to use a Pool with a connection string, as noted here. I could also put together a test case for this if you want. |
@brianc I think in general it makes sense to be able to pass a connection string. I've used this approach as well for other applications. |
@0x8890 if all you're wanting to do is pass a connection string to @brianc please correct me if I'm wrong. |
👍 |
const db = new PgPool({
connectionString: process.env.DATABASE_URL,
}); Works, this is a documentation issue |
I'd like to add connection string support back in to pg@7.0 in some form. It gets weird because you're configuring the pool and the client in a single string, but I think we can make it work in a way that makes everyone more productive & happy, which is the point! I'll add this to the 7.0 milestone. |
@brianc Awesome that you are working on a 7.0, any way we can see the planned "roadmap"? thanks |
@vvo - you bet! here you go right now just organizing issues into there, and I'll be adding more. First I want to overhaul the documentation to be better - it's old & a lot of issues I get are opened that should be answered in docs. I also get a lot of word of mouth reports about things that have been confusing in the past. Please feel free to open any issues around things you'd like to see added/changed in 7.0 as well as anything you think is missing from the docs - I'll add 'em to the appropriate milestones & work on them. |
as @vvo pointed out you can pass a connection string as the |
It seems that
Pool
doesn't accept connection parameters likeconnect
does, this fixes that.