8000 Allow configuration flags to be set within individual .env files by adam-prickett · Pull Request #200 · vlucas/phpdotenv · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow configuration flags to be set within individual .env files #200

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 2 commits into from
Closed

Allow configuration flags to be set within individual .env files #200

wants to merge 2 commits into from

Conversation

adam-prickett
Copy link

No description provided.

@stedaniels
Copy link

@vlucas is anything needed to get this merged? Or do you just not want to do this kind of thing and you're being polite by not saying? :-) Being too busy too look at it is totally a valid reason. (I've got three kids under three!)

@cronfy
Copy link
cronfy commented Jan 9, 2017

I do not like the idea that .env file dictates to webserver where to store environment variables. It is also not flexible to put these settings in the .env file.

Why not just have a load() equivalent, that only returns array of env variables without touching $_ENV/$_SERVER/putenv(), e. g. read()? (also see #163).

@tuupola
Copy link
tuupola commented Jan 9, 2017

I am against merging this patch. One should be able to do $ source .env and expect the shell to have same environment variables as PHP has after calling $dotenv->load();.

@vlucas
Copy link
Owner
vlucas commented Jan 13, 2017

I don't like controlling phpdotenv itself with environment variables that it loads. This seems like something that should be in the PHP code or config instead.

@vlucas vlucas closed this Jan 13, 2017
@schmunk42
Copy link

@vlucas I just came across the same issue, like #196; several frameworks also log $_SERVER which is populated with ENV variables.

Sure, $_SERVER contains critical values by default, but it should be up to the developer if he wants to populate $_SERVER or not.

The current hacky way is to sanitize $_SERVER manually.

@cronfy
Copy link
cronfy commented Jan 16, 2017

I like the way it is solved here: https://github.com/josegonzalez/php-dotenv

$Loader = (new josegonzalez\Dotenv\Loader('path/to/.env'))
              ->parse();

Then array of options can either be returned via toArray() or populate env via toEnv(), but it is the developer who decides, where env variables go.

@GrahamCampbell
Copy link
Collaborator

Replaced by #300. See https://github.com/vlucas/phpdotenv#loader-customization for an example.

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.

7 participants
0