#1799 -- Fix port checker conditional.

This commit is contained in:
Buster Neece 2019-07-30 09:19:45 -05:00
parent 06782748ef
commit f06a6e2b66
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
1 changed files with 12 additions and 2 deletions

View File

@ -11,6 +11,9 @@ use Supervisor\Supervisor;
class Configuration
{
public const DEFAULT_PORT_MIN = 8000;
public const DEFAULT_PORT_MAX = 8499;
/** @var EntityManager */
protected $em;
@ -338,8 +341,15 @@ class Configuration
// Iterate from port 8000 to 9000, in increments of 10
$protected_ports = [8080];
$port_min = (int)(getenv('AUTO_ASSIGN_PORT_MIN') ?? 8000);
$port_max = (int)(getenv('AUTO_ASSIGN_PORT_MAX') ?? 8499);
$port_min = (int)getenv('AUTO_ASSIGN_PORT_MIN');
if (0 === $port_min) {
$port_min = self::DEFAULT_PORT_MIN;
}
$port_max = (int)getenv('AUTO_ASSIGN_PORT_MAX');
if (0 === $port_max) {
$port_max = self::DEFAULT_PORT_MAX;
}
for($port = $port_min; $port <= $port_max; $port += 10) {
if (in_array($port, $protected_ports, true)) {