Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

gr0uch
Copy link

@gr0uch gr0uch commented Jul 1, 2016

It seems that Pool doesn't accept connection parameters like connect does, this fixes that.

@brianc
Copy link
Owner

brianc commented Jul 10, 2016

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.

@gr0uch
Copy link
Author

gr0uch commented Jul 11, 2016

@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.

@Voles
Copy link

Voles commented Jul 14, 2016

@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.

@allspiritseve
Copy link

@0x8890 if all you're wanting to do is pass a connection string to pg.Pool, I believe you can already do so as options passed when creating a pool are used to create clients and pg.Client accepts a connectionString parameter.

@brianc please correct me if I'm wrong.

@AlJohri
Copy link

AlJohri commented Jan 8, 2017

👍

@vvo
Copy link

vvo commented May 11, 2017

const db = new PgPool({
  connectionString: process.env.DATABASE_URL,
});

Works, this is a documentation issue

@brianc
Copy link
Owner

brianc commented May 24, 2017

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 brianc added this to the pg@7.0 milestone May 24, 2017
@vvo
Copy link

vvo commented May 24, 2017

@brianc Awesome that you are working on a 7.0, any way we can see the planned "roadmap"? thanks

@brianc
Copy link
Owner

brianc commented May 24, 2017

@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.

@brianc
Copy link
Owner

brianc commented Jun 8, 2017

as @vvo pointed out you can pass a connection string as the connectionString parameter to the pool. I just added a regression test to this repo here to make sure this remains covered forevermore. This makes the most sense because the pool also accepts other config parameters that don't apply to the client so passing the string as one of many options is the way to go. I've documented this here.

@brianc brianc closed this Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants