fix: wrong env variable parsing

This commit is contained in:
Andras Bacsai 2023-12-28 17:53:47 +01:00
parent 5596e41f2b
commit 019887739c
2 changed files with 65 additions and 52 deletions
bootstrap/helpers

@ -216,6 +216,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
$labels = collect([]);
$labels->push('traefik.enable=true');
foreach ($domains as $loop => $domain) {
try {
$uuid = new Cuid2(7);
$url = Url::fromString($domain);
$host = $url->getHost();
@ -265,6 +266,10 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
$labels->push("traefik.http.middlewares.{$http_label}-stripprefix.stripprefix.prefixes={$path}");
}
}
} catch(\Throwable $e) {
continue;
}
}
return $labels;

@ -102,6 +102,7 @@ function refreshSession(?Team $team = null): void
}
function handleError(?Throwable $error = null, ?Livewire\Component $livewire = null, ?string $customErrorMessage = null)
{
ray($error);
if ($error instanceof TooManyRequestsException) {
if (isset($livewire)) {
return $livewire->dispatch('error', "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.");
@ -227,11 +228,15 @@ function base_ip(): string
}
function getFqdnWithoutPort(String $fqdn)
{
try {
$url = Url::fromString($fqdn);
$host = $url->getHost();
$scheme = $url->getScheme();
$path = $url->getPath();
return "$scheme://$host$path";
} catch (\Throwable $e) {
return $fqdn;
}
}
/**
* If fqdn is set, return it, otherwise return public ip.
@ -1520,6 +1525,9 @@ function parseEnvVariable(Str|string $value)
$command = $value->after('SERVICE_')->before('_');
$forService = $value->after('SERVICE_')->after('_')->before('_');
$port = $value->afterLast('_');
if (filter_var($port, FILTER_VALIDATE_INT) === false) {
$port = null;
}
} else {
// SERVICE_BASE64_64_UMAMI
$command = $value->after('SERVICE_')->beforeLast('_');