Skip to content

Commit 6257d84

Browse files
authored
Merge pull request #14 from andersundsehr/bugfix/vhost-generation
2 parents 8716c60 + 0ae699c commit 6257d84

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/generate-vhosts.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ public function __construct()
2222

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

25-
$domainByVmNumber[$vmNumber][] = $domain;
25+
if($vmNumber) {
26+
$domainByVmNumber[$vmNumber][] = $domain;
27+
}
2628
}
2729

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

7678
private function removeOldCert(SplFileInfo $file): bool

0 commit comments

Comments
 (0)