Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

checking for .env file exists instead of using the env variable #176

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
wants to merge 1 commit into from
Closed

checking for .env file exists instead of using the env variable #176

wants to merge 1 commit into from

Conversation

weaverryan
Copy link
Member

Q A
License MIT

Hi guys!

This comes from a workshop I gave last week. One user - from using Laravel - already had an APP_ENV environment variable defined in their VM. Because of this, their .env file was being completely ignored, which was difficult to track down.

I think it's much simpler if we require the .env file simply if it exists. If you agree, there's one other change to make (https://github.com/symfony/flex/blob/d68d28624e3ec972d6887cca06f7df5e07ba03a9/src/Configurator/MakefileConfigurator.php#L34), which I can do.

Cheers!

@stof
Copy link
Member

stof commented Sep 12, 2017

We also need to make a change in Flex, as it would copy the .env.dist to .env on composer install, which would make the .env file to be loaded in production (which we don't want)

@fabpot
Copy link
Member

fabpot commented Sep 12, 2017

I'm very much against this change. It's a question of precedence and I don't want to change it. It's consistent with the behavior of other frameworks and we/I take advantage of this property in many projects. What we could do instead is having a CLI tool that list defined env vars and tell the dev where they are coming from (env var, .env, $_SERVER, ...).

@fabpot
Copy link
Member

fabpot commented Sep 12, 2017

see symfony/symfony#24144

@weaverryan
Copy link
Member Author

Hmm. Ok. Then we'll solve it in other ways - i.e. finding ways to be a bit more verbose about where environment vars are coming from, or if the .env file is loaded or not. We need to try to make it as obvious as possible when you have a .env file, but it is not being used (especially if you're in the debug mode where we can be more verbose with things).

@weaverryan weaverryan closed this Sep 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.