-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Constructors for Pool and connection types to get configuration from environment #39
Comments
I think we were discussing something to this effect (not locked in to the naming): // Equivalent to: Connection::open(env::var("DATABASE_URL").unwrap_or_default())
Connection::open_from_env()
// Equivalent to: Pool::new(env::var("DATABASE_URL").unwrap_or_default())
Pool::from_env()
// Equivalent to: Pool::builder().build(env::var("DATABASE_URL").unwrap_or_default())
Pool::builder().build_from_env() |
Started jamming on this a bit tonight, hoping to have some updates early next week or sooner. |
Hi. I started to work on this task today and I have two questions:
|
That comment was outdated. The new method I believe should be on the
Do you mean for |
However, I think we need to discuss this a bit more as we want to combine this with #78, however that implies that the individual connection type defines what parameters it tries to get from the environment; maybe instead the new method on fn url_from_env() -> crate::Result<Url>; Where the implementation populates as many parts of the URL as it can (username, password, host, port, database) with information from the environment and then uses published defaults for the rest. |
I like the second approach @abonander. Thank you! |
Marking this as blocked on doing #174 first |
We now have I can see adding We should probably also add |
TODO: fill this out when I'm not on a phone
The text was updated successfully, but these errors were encountered: