8000 [RFC][Dotenv] Introduce DOTENV_OVERLOAD · Issue #29170 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[RFC][Dotenv] Introduce DOTENV_OVERLOAD #29170

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

Closed
ro0NL opened this issue Nov 10, 2018 · 5 comments
Closed

[RFC][Dotenv] Introduce DOTENV_OVERLOAD #29170

ro0NL opened this issue Nov 10, 2018 · 5 comments
Labels
Dotenv RFC RFC = Request For Comments (proposals about features that you want to be discussed)

Comments

@ro0NL
Copy link
Contributor
ro0NL commented Nov 10, 2018

Description
Now .env is the new .env.dist, im kinda stuck with local infrastructure.

The setup auto-detects .env and creates real envs as such in the container being spinned up. This totally breaks things as .env.local is not being loaded at this point.

To keep things simple (i cant really control this yet - lando/lando#994) it would be nice to control overloading for now with a new DOTENV_OVERLOAD=1 var.

It would be auto-detected in Dotenv::loadEnv() and toggles load() vs overload() as such.

Thoughts?

@ro0NL ro0NL changed the title [RFC] Introduce DOTENV_OVERLOAD [RFC][Dotenv] Introduce DOTENV_OVERLOAD Nov 10, 2018
@nicolas-grekas
Copy link
Member

Another idea: load .env.dist when .env is not found, in loadEnv(). Would it make sense?

@ro0NL
Copy link
Contributor Author
ro0NL commented Nov 10, 2018

hm 🤔 i need .env.local to be loaded :)

Currently flex still generates both .env and .env.dist with the same contents, and AFAIK for the same purpose - to be committed in VCS.

Im still stuck wi 8000 th the vars from .env being loaded as real envs / pre-bootstrap.

@javiereguiluz javiereguiluz added RFC RFC = Request For Comments (proposals about features that you want to be discussed) Dotenv labels Nov 11, 2018
@nicolas-grekas
Copy link
Member

See #29171 for an alternative. I think it solves the issue without introducing radically new idiomatism.

@ro0NL
Copy link
Contributor Author
ro0NL commented Nov 11, 2018

got ya, it would work yes. I simply remove .env then

is there some Flex WIP going on still? Or will it always generate both now the same, for the user to decide what to keep and what not.

@nicolas-grekas
Copy link
Member

The plan is to remove .env.dist from the flex recipe once symfony/flex#434 is released.

nicolas-grekas added a commit that referenced this issue Nov 12, 2018
…nd (nicolas-grekas)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Dotenv] load .env.dist when it exists and .env is not found

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29170
| License       | MIT
| Doc PR        | -

As illustrated in #29170, it can be useful to opt out from the `.env` convention and fall back to defining env vars in `.env.dist` instead. This PR allows that by loading `.env.dist` when it exists and `.env` is not found.

Needs symfony/flex#434 to work seamlessly when using Flex.

Commits
-------

841185b [Dotenv] load .env.dist when it exists and .env is not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dotenv RFC RFC = Request For Comments (proposals about features that you want to be discussed)
Projects
None yet
Development

No branches or pull requests

3 participants
0