Skip to content

Commit

Permalink
add no-reload option
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 23, 2020
1 parent aabd2c9 commit 9cc2622
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Illuminate/Foundation/Console/ServeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ public function handle()
clearstatcache(false, $environmentFile);
}

if ($hasEnvironment && filemtime($environmentFile) > $environmentLastModified) {
if (! $this->option('no-reload') &&
$hasEnvironment &&
filemtime($environmentFile) > $environmentLastModified) {
$environmentLastModified = filemtime($environmentFile);

$this->comment('Environment modified. Restarting server...');
Expand Down Expand Up @@ -93,6 +95,10 @@ public function handle()
protected function startProcess()
{
$process = new Process($this->serverCommand(), null, collect($_ENV)->mapWithKeys(function ($value, $key) {
if ($this->option('no-reload')) {
return [$key => $value];
}

return $key === 'APP_ENV'
? [$key => $value]
: [$key => false];
Expand Down Expand Up @@ -164,6 +170,7 @@ protected function getOptions()
['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', '127.0.0.1'],
['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', Env::get('SERVER_PORT')],
['tries', null, InputOption::VALUE_OPTIONAL, 'The max number of ports to attempt to serve from', 10],
['no-reload', null, InputOption::VALUE_NONE, 'Do not reload the development server on .env file changes'],
];
}
}

0 comments on commit 9cc2622

Please sign in to comment.