Skip to content
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

[9.x] Extract ServeCommand env list to static property #42444

Merged
merged 2 commits into from
May 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/Illuminate/Foundation/Console/ServeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ class ServeCommand extends Command
*/
protected $portOffset = 0;

/**
* The environment variables that should be passed from host machine to the PHP server process.
*
* @var string[]
*/
public static $passthroughVariables = [
'APP_ENV',
'LARAVEL_SAIL',
'PHP_CLI_SERVER_WORKERS',
'PHP_IDE_CONFIG',
'SYSTEMROOT',
'XDEBUG_CONFIG',
'XDEBUG_MODE',
'XDEBUG_SESSION',
];

/**
* Execute the console command.
*
Expand Down Expand Up @@ -111,16 +127,7 @@ protected function startProcess($hasEnvironment)
return [$key => $value];
}

return in_array($key, [
'APP_ENV',
'LARAVEL_SAIL',
'PHP_CLI_SERVER_WORKERS',
'PHP_IDE_CONFIG',
'SYSTEMROOT',
'XDEBUG_CONFIG',
'XDEBUG_MODE',
'XDEBUG_SESSION',
]) ? [$key => $value] : [$key => false];
return in_array($key, static::$passthroughVariables) ? [$key => $value] : [$key => false];
})->all());

$process->start(function ($type, $buffer) {
Expand Down