deadpool
deadpool copied to clipboard
Config from url like user:pass@host/db
Is it possible to connect using url?
Like psql://user:pass@host/db
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.
Any progress on this?
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.