Skip to content

Commit

Permalink
Merge pull request #14 from andersundsehr/bugfix/vhost-generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanti authored Feb 9, 2024
2 parents 8716c60 + 0ae699c commit 6257d84
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/generate-vhosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public function __construct()

$vmNumber = $this->getVmNumber($domain);

$domainByVmNumber[$vmNumber][] = $domain;
if($vmNumber) {
$domainByVmNumber[$vmNumber][] = $domain;
}
}

$result = file_get_contents(self::INITAL_NGINX_CONF);
Expand Down Expand Up @@ -70,7 +72,7 @@ public function __construct()
private function getVmNumber(string $domain): int
{
preg_match($this->getEnv('VM_NUMBER_REGEX', '/(^|\.)vm(?<vmNumber>[0-9]{2})\./'), $domain, $matches);
return (int)($matches['vmNumber'] ?? throw new \Exception(''));
return (int)($matches['vmNumber'] ?? 0);
}

private function removeOldCert(SplFileInfo $file): bool
Expand Down

0 comments on commit 6257d84

Please sign in to comment.