-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[5.8] Handle DATABASE_URL env variable for database connection #28096
Conversation
c973d57
to
c24eebe
Compare
Which cloud providers? |
Heroku does this, for example |
Please remove all the nullable type-hints. They are useless. Thanks. |
@taylorotwell Sorry I don't understand what you mean: do you want that I remove all the type-hint or just the nullable part? Because in the first case, it will not work as I'm actually waiting for a nullable string, and doing checks on the null value. Do you confirm that you're interested by adding and merging this feature, and so I can invest more time on it? If you need more examples of cloud providers, or ORM, I can look up and link them to you. |
So does Heroku not provide the traditional host name / port? You can only use this specifically formatted URL? |
I'm fine in general with supporting it if Heroku provides no other way to connect to databases. |
Is there somewhere the format of this URL is standardized / documented? |
I didn't found anything really agnostically standardized, but each language/framework has its documentation:
At the end, it's the classic url format (same than for http and ftp protocoles or any software)
so in a database context:
Examples: The behavior will be clearer when test will be added. |
Gotcha. |
Feel free to add tests. |
Closing pending inactivity but I do think this is kind of a nice idea if anyone else wants to pick it up. |
Hey folks, I've made another PR : #28308! |
Hi,
Many cloud providers use urls env var to configure the database connection (often DATABASE_URL), and many ORM (in many languages) handle them too.
The PR aims to handle those urls.
This is inspired by the Doctrine way to handle them.
This is just a draft, coming directly from my projects, feedback and comments are welcomed.
If someone in the Laravel core team confirms me that this is a wanted feature and that it will be merged, I will be glad to spend more time on it.
Roadmap:
database.php
config file to use that classIdeas for usage (to challenge, could be easier):
Thanks,
Matt'