You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use this component in development with Docker. We like to put defaults for environment variables in the Docker config, but we let developers override those values in the .env file. After switching to the Symfony component, we realized that those overrides were no longer happening.
The Dotenv class could accept an optional flag that would tell it if it should override system environment variables. It could default to false to maintain BC.
The text was updated successfully, but these errors were encountered:
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Dotenv] add a flag to allow env vars override
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #26846
| License | MIT
| Doc PR | symfony/symfony-docs#9568
I choose to use a new parameter in the constructor instead of `populate()` to not add boilerplate code to them who want allow overriding in their current setup. It's just a parameter to add in `Dotenv` creation instead of change or customize the loading of different .env files.
I targeted 4.1 despite the feature freeze because it's a small change but if you don't agree I can change to 4.2.
~~If you accept this PR I will do the doc PR then.~~
doc ready
Commits
-------
228b220 [Dotenv] add Dotenv::overload() to allow env vars override
We use this component in development with Docker. We like to put defaults for environment variables in the Docker config, but we let developers override those values in the
.env
file. After switching to the Symfony component, we realized that those overrides were no longer happening.The
Dotenv
class could accept an optional flag that would tell it if it should override system environment variables. It could default tofalse
to maintain BC.The text was updated successfully, but these errors were encountered: