Skip to content

Commit 0ae699c

Browse files
committed
šŸ› fix vhost generation if wrong cert is present
1 parent 8716c60 commit 0ae699c

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)