Skip to content
Permalink
Browse files

tweaks to server command. respect explicit port.

  • Loading branch information...
taylorotwell committed Jun 15, 2019
1 parent a1c039c commit 6a18e73f63f46b6aa5ab6faceb9eb5060c64fc15
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/Illuminate/Foundation/Console/ServeCommand.php
@@ -86,7 +86,9 @@ protected function host()
*/
protected function port()
{
return $this->input->getOption('port') + $this->portOffset;
$port = $this->input->getOption('port') ?: 8000;
return $port + $this->portOffset;
}
/**
@@ -96,7 +98,8 @@ protected function port()
*/
protected function canTryAnotherPort()
{
return $this->input->getOption('tries') > $this->portOffset;
return is_null($this->input->getOption('port')) &&
($this->input->getOption('tries') > $this->portOffset);
}
/**
@@ -109,7 +112,7 @@ protected function getOptions()
return [
['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('SERVER_PORT', 8000)],
['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', $_ENV['SERVER_PORT'] ?? null],
['tries', null, InputOption::VALUE_OPTIONAL, 'The max number of ports to attempt to serve from', 10],
];

0 comments on commit 6a18e73

Please sign in to comment.
You can’t perform that action at this time.