Move loading .env files to bootstrap.php#491
Move loading .env files to bootstrap.php#4911 commit merged intosymfony:masterfrom nicolas-grekas:config-bootstrap
Conversation
nicolas-grekas
left a comment
There was a problem hiding this comment.
Self review for tomorrow :)
|
PR tested locally, works like a charm. The critical feature this PR provides is decoupling recipes. As explained in the description, the current recipes are broken because they make too many assumptions. Note that this PR introduces a new PR ready. Votes pending. |
|
for anyone running paratest, this will break your tests. Still looking for a solution. |
|
You need to define // tests/bootstrap.php
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = 'test');
require dirname(__DIR__).'/src/.bootstrap.php'); |
|
Yep - lovely, thankyou. Have submitted an issue to paratest. |
|
@nicolas-grekas is there a bug in These two should be equivalent, shouldn't they? > APP_ENV=prod APP_DEBUG=0 bin/console cache:clear --no-warmup
> bin/console cache:clear --no-warmup --env=prod --no-debugThe 2nd will result in Edit: Reproducer: > composer create-project symfony/skeleton skeleton
> cd skeleton
> rm -rf vendor
> composer install --no-dev #error will be here too.
> bin/console cache:clear --no-warmup --env=prod --no-debug |
In #481, we completely forgot about apps that migrate to flex.
#481 relies on the Kernel being created at the same time as eg
bin/console; but apps migrating to flex already have a Kernel, and it won't be updated automatically.Here is a radically simpler approach: let's factorize loading
.envfiles in a newbootstrap.phpfile that is used as instead ofvendor/autoload.phpto bootstrap the app.