-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[8.x] Inject the list of env vars that are passed on to the web server #38211
Conversation
…to the built-in webserver are supplied to the command and can be overriden in a service provider.
public function __construct(array $passthruEnvVars = ['APP_ENV', 'LARAVEL_SAIL', 'PHP_CLI_SERVER_WORKERS']) | ||
{ | ||
parent::__construct(); | ||
|
||
$this->passthruEnvVars = $passthruEnvVars; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this allow the user to remove the required APP_ENV
and LARAVEL_SAIL
environment variables? Originally those two were hard coded, presumably as they are required.
This will allow the user to effectively remove those variables by not passing them into the allowed array. Perhaps have a default array and array_merge
the incoming $passthruEnvVars
.
for example:
$this->passthruEnvVars = \array_merge(['APP_ENV', 'LARAVEL_SAIL', 'PHP_CLI_SERVER_WORKERS'], $passthruEnvVars);
Thanks for your pull request to Laravel! Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include. If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions! If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response. |
I would rather just explicitly list the XDEBUG variables. |
@taylorotwell would you be more accepting of a PR that adds the XDEBUG_MODE and XDEBUG_CONFIG env vars to the list of hardcoded variables? This is essentially the same issue that this PR was experiencing #38208 that was accepted yesterday. But instead of a PHP env var that controls multi-threading, these are env vars that control the xdebug extension. Without some update to the current hardcoded version, we are forced to override the |
@taylorotwell perfect. I'll make a new PR. |
This is needed for when using a
.env
file but still need to provide environment variables to PHP or a PHP extension such as xdebug.Currently, Laravel Sail won't work with xdebug if you provide the configuration thru the XDEBUG_MODE and XDEBUG_CONFIG environment variables because this command doesn't pass the variables onto the php web server. You are forced to provide the xdebug configuration in the php.ini file but that isn't convenient for being able to turn xdebug on/off and switch between modes.
I'm sure there are other use cases as well where being able to modify the list of variables that are passed on to the php webserver are useful, for instance this PR: #38208