Add generate_unique_uuid parameter to fqdnLabelsForTraefik function

This commit is contained in:
Andras Bacsai 2024-04-29 10:49:50 +02:00
parent 3df80f2653
commit 94ad56fc96
3 changed files with 8 additions and 4 deletions

View File

@ -8,6 +8,7 @@
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Spatie\Url\Url;
use Visus\Cuid2\Cuid2;
function getCurrentApplicationContainerStatus(Server $server, int $id, ?int $pullRequestId = null, ?bool $includePullrequests = false): Collection
{
@ -272,7 +273,7 @@ function fqdnLabelsForCaddy(string $network, string $uuid, Collection $domains,
}
return $labels->sort();
}
function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_https_enabled = false, $onlyPort = null, ?Collection $serviceLabels = null, ?bool $is_gzip_enabled = true, ?bool $is_stripprefix_enabled = true, ?string $service_name = null)
function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_https_enabled = false, $onlyPort = null, ?Collection $serviceLabels = null, ?bool $is_gzip_enabled = true, ?bool $is_stripprefix_enabled = true, ?string $service_name = null, bool $generate_unique_uuid = false)
{
$labels = collect([]);
$labels->push('traefik.enable=true');
@ -313,7 +314,9 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
}
foreach ($domains as $loop => $domain) {
try {
// $uuid = new Cuid2(7);
if ($generate_unique_uuid) {
$uuid = new Cuid2(7);
}
$url = Url::fromString($domain);
$host = $url->getHost();
$path = $url->getPath();

View File

@ -1620,7 +1620,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
$serviceLabels = $serviceLabels->merge(fqdnLabelsForTraefik(
uuid: $resource->uuid,
domains: $fqdns,
serviceLabels: $serviceLabels
serviceLabels: $serviceLabels,
generate_unique_uuid: $resource->build_pack === 'dockercompose'
));
$serviceLabels = $serviceLabels->merge(fqdnLabelsForCaddy(
network: $resource->destination->network,

View File

@ -77,7 +77,7 @@ class="fixed top-4 right-16" x-on:click="toggleScroll"><svg class="icon" viewBox
stroke-width="2" d="M12 5v14m4-4l-4 4m-4-4l4 4" />
</svg></button>
<button title="Fullscreen" x-show="!fullscreen" class="absolute top-6 right-4"
<button title="Fullscreen" x-show="!fullscreen" class="absolute top-5 right-1"
x-on:click="makeFullscreen"><svg class="icon" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<g fill="none">