deadpool icon indicating copy to clipboard operation
deadpool copied to clipboard

Config from url like user:pass@host/db

Open incker opened this issue 2 years ago • 1 comments

Is it possible to connect using url?

Like psql://user:pass@host/db

incker avatar May 16 '22 16:05 incker

I've started working on a branch which adds this feature: https://github.com/bikeshedder/deadpool/tree/feature/postgres-config-from-url

It's a breaking change and I'd first like to decide on #74 which is related to changing the structure of the configuration structs.

bikeshedder avatar May 19 '22 09:05 bikeshedder

Any progress on this?

bbigras avatar Apr 24 '23 20:04 bbigras

I just released deadpool-postgres 0.12 to crates.io which does support configuration by URL:

  • https://crates.io/crates/deadpool-postgres/0.12.0

Unlike the original PR you can specify both url and the other connection parameters and they're merged in order. First the URL is parsed (if it exists) and then the other parameters are applied. Just a note of warning. host and hosts unlike the other parameters are additive.

Initially I thought this being a bad idea but I feel like being able to override things like SSL mode outside of the URL could provide useful in some scenarios. So limiting the user to either URL or structured configuration could be considered an anti feature.

bikeshedder avatar Dec 15 '23 14:12 bikeshedder