-
-
Notifications
You must be signed in to change notification settings - Fork 624
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
Don't overwrite existing environment variables. #17
Conversation
Ruby's dotenv does this with `ENV[key] ||= value`. The point of dotenv / phpdotenv is to enable twelve-factor style configuration via environment, so it's important to be able to override these `.env` files with external environment variables.
+1 I think this is a good addition. For BC maybe it would make sense to offer some sort of parameter to control this? |
I'd suggest “backwards compatibility” be handled through versioning. This should be tagged as This keeps the complexity in version history instead of runtime code. Edit: http://semver.org/ for reference. |
My point was that the change in behavior could be made w/o having to break the rules of semver by providing an additional optional parameter that defaulted to the current behavior. I think this and issue #20 are great items for a v.2 and help make dotenv a more progressive configuration approach. |
#14 will go into v2.0.0 as well. I have already started on it. |
@stanlemon My point is that optional parameters which turn on old broken behavior are complexity that a small semver codebase doesn't need to carry around with it :) |
Any word on this? Would be great to get this compatible with how the other major dotenv tools work. |
I'd like to see an |
@vlucas It seems crazy to have an option which enables a bug. The semver bump to v2.0.0 will stop the change taking anybody by surprise. The current simplicity is great; no optional behavior anywhere, just If you're certain you want to be able to opt-in to overwriting, I'll add that option, but I think it's a bad idea. Cheers, |
FWIW, I agree with @pda. Something like dotenv behaviour should be dead standard across all platforms. Less magic is better. |
Don't overwrite existing environment variables.
Okay. Agreed. I don't think this will break anything either. |
Excellent, thanks @vlucas. |
Ruby's dotenv does this with
ENV[key] ||= value
.The point of dotenv / phpdotenv is to enable twelve-factor style configuration
via environment, so it's important to be able to override these
.env
fileswith external environment variables.