FRiCKLE/ngx_postgres — Issue #10: use arbitrary connection strings
Author: wulczer
Created: 2011-12-19 13:06:19+00:00
State: open

The module is great, but it would be useful to have more flexibility whne choosing the way Nginx connects to Postgres.

I'm working on adding a way to pass arbitrary libpq connection strings, so you could do things like:

postgres_connstring host=/var/run/postgresql dbname=mydb

to get a connection over UNIX sockets or even:

postgres_connstring sslcert=... sslrootcert=... ...

which is our use case, since we're authenticating all applications using the database with SSL certificates.

I'm wondering what would be the best way to implement it (and whether you'd be willing to accept such a patch). A separate directive (like postgres_connstring) that overrides postgres_server? Making postgres_server understand that if the directive is not "host:ip params", it's a literal libpq connstring? Something else entirely?