Join GitHub today
[Dotenv] add loadEnv(), a smoother alternative to loadForEnv() #29129
This PR replaces the
In addition to $path (.env), the following files are loaded, the latter taking precedence in this order:
Last but not least, the "test" env has this special behaviors:
But not aligned with
I'm used to occasionally start phpunit with
Sure. create-react-app has the behavior that best matches Symfony, so why should we care more about bkeepers?
Nope it won't, useless you defined
Based on which facts?
Indeed. We provided the value in https://github.com/symfony/recipes/blob/5b3ce909504b9366405820c49bc9f0e13ac4be54/symfony/phpunit-bridge/4.1/phpunit.xml.dist#L14, but that's not relevant with planned changes.
So, what do you preconize for CI appart from either removing
You're asking because you think we should keep the current behavior?
My arguments for the new one are:
yes, this is described in https://metaskills.net/2013/10/03/using-dotenv-in-rails/
the reason is that tests run in a special set of configuration and the very purpose of .env.test is to commit that configuration. If you don't want to follow what the devs set there, you have to do extra work. OR if your test setup needs to be flexible, you can omit defining those vars in .env files.
Are you sure about that? According to their docs, it's not the case by default, but you can use
What would it be like in the recipe with the
--env re-introduction, though?
Dotenv::loadEnv('.env', 'APP_ENV', $input->getParameterOption(['--env', '-e'], 'dev', true));
--env would be ignored if
APP_ENV env var is set...which is fine to me. Just sayin' :)