fix(revert): label parsing

This commit is contained in:
Andras Bacsai
2025-02-28 20:25:19 +01:00
parent 5ac43fd426
commit a402c28606
2 changed files with 69 additions and 92 deletions

View File

@@ -569,7 +569,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
if ($shouldGenerateLabelsExactly) {
switch ($application->destination->server->proxyType()) {
case ProxyTypes::TRAEFIK->value:
$proxyLabels = fqdnLabelsForTraefik(
$labels = $labels->merge(fqdnLabelsForTraefik(
uuid: $appUuid,
domains: $domains,
onlyPort: $onlyPort,
@@ -577,11 +577,10 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(),
redirect_direction: $application->redirect
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
));
break;
case ProxyTypes::CADDY->value:
$proxyLabels = fqdnLabelsForCaddy(
$labels = $labels->merge(fqdnLabelsForCaddy(
network: $application->destination->network,
uuid: $appUuid,
domains: $domains,
@@ -590,12 +589,11 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(),
redirect_direction: $application->redirect
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
));
break;
}
} else {
$proxyLabels = fqdnLabelsForTraefik(
$labels = $labels->merge(fqdnLabelsForTraefik(
uuid: $appUuid,
domains: $domains,
onlyPort: $onlyPort,
@@ -603,9 +601,8 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(),
redirect_direction: $application->redirect
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels = fqdnLabelsForCaddy(
));
$labels = $labels->merge(fqdnLabelsForCaddy(
network: $application->destination->network,
uuid: $appUuid,
domains: $domains,
@@ -614,8 +611,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled(),
redirect_direction: $application->redirect
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
));
}
}
} else {
@@ -628,18 +624,17 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
if ($shouldGenerateLabelsExactly) {
switch ($application->destination->server->proxyType()) {
case ProxyTypes::TRAEFIK->value:
$proxyLabels = fqdnLabelsForTraefik(
$labels = $labels->merge(fqdnLabelsForTraefik(
uuid: $appUuid,
domains: $domains,
onlyPort: $onlyPort,
is_force_https_enabled: $application->isForceHttpsEnabled(),
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled()
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
));
break;
case ProxyTypes::CADDY->value:
$proxyLabels = fqdnLabelsForCaddy(
$labels = $labels->merge(fqdnLabelsForCaddy(
network: $application->destination->network,
uuid: $appUuid,
domains: $domains,
@@ -647,21 +642,19 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_force_https_enabled: $application->isForceHttpsEnabled(),
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled()
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
));
break;
}
} else {
$proxyLabels = fqdnLabelsForTraefik(
$labels = $labels->merge(fqdnLabelsForTraefik(
uuid: $appUuid,
domains: $domains,
onlyPort: $onlyPort,
is_force_https_enabled: $application->isForceHttpsEnabled(),
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled()
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
$proxyLabels = fqdnLabelsForCaddy(
));
$labels = $labels->merge(fqdnLabelsForCaddy(
network: $application->destination->network,
uuid: $appUuid,
domains: $domains,
@@ -669,13 +662,9 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
is_force_https_enabled: $application->isForceHttpsEnabled(),
is_gzip_enabled: $application->isGzipEnabled(),
is_stripprefix_enabled: $application->isStripprefixEnabled()
);
$labels = $labels->merge(convertToKeyValueCollection($proxyLabels));
));
}
}
$labels = $labels->map(function ($value, $key) {
return "$key=$value";
})->values();
return $labels->all();
}