-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Feature Request: More flexible .env.* chosing #661
Comments
🤔 we could define the concept of an "env loader" and make the current implementation the default one. One issue is still how people could customize it? We could try to open a standard file location for any customized loader (eg: On the other hand, this is probably fairly niche (since it hasn't come up in ~8 years+) and since Bedrock is designed as a boilerplate to be edited, I'm tempted to do nothing and the proper solution is to modify the core file. If you want to open a PR with a proposed solution it would help evaluate it, but no promises on it being merged. |
Probably niche but more elegant than any other solution when it comes to handling multiple databases under the same WP instance. I know about the |
From my point of view, Bedrock should include by default only one way to load env variables; and it should be as simple and general as possible. You could load env files by looking at a server variable for example As you can see, this could scale indefinitely and in the long run it will be impossible to handle every use case.
Handle multiple databases under the same WP instance to me seems like a particular use case where manually editing the boilerplate could make sense. If you think about it also in WP if you want to handle multiple databases under the same instance you must customize the |
No need for this. Just:
The last bit I'm trying to workaround is the custom WP_ENV (let's say The goes down to whether only one environment is dedicated to production or if this is an arbitrary limitation which must be removed (I tend to think so). At least something like |
Closing since we aren't likely to add this. |
Terms
Summary
config/application.php looks for
.env
assuming only one such file exist (and consequently one database can be connected to that bedrock installation).Several scenario require more flexible
.env
choosing. In my team, I replace the loader by:So that locally, our various projects can be access using a subdomain, eg:
site1.localhost.dev
would load.env.site1
.Today I found that it was a neat way to get WordPress network up and running in -production while still having one database per instance (something not supported by WP), eg:
It works well but I'd prefer to do that without modifying Bedrock core files.
Any chance to get a
hook
or similar that would allow to customize the .env selection inside a 3rd-party file?Motivation
Why are we doing this?
To support multiple database per Bedrock installation
What use cases does it support?
Local development, improved WP network setup
What is the expected outcome?
More flexible multi-db setups
Potential conflicts / foreseeable issues
None
Additional Context
No response
The text was updated successfully, but these errors were encountered: