Skip to content

Commit 7b041f3

Browse files
committed
refactor: Improve handling of COOLIFY_URL in shared.php
1 parent 8150b6f commit 7b041f3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bootstrap/helpers/shared.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,7 +3425,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
34253425
$defaultLabels = defaultLabels($resource->id, $containerName, type: 'service', subType: $isDatabase ? 'database' : 'application', subId: $savedService->id);
34263426
}
34273427
// Add COOLIFY_FQDN & COOLIFY_URL to environment
3428-
if (! $isDatabase && $fqdns?->count() > 0) {
3428+
if (! $isDatabase && $fqdns instanceof Collection && $fqdns->count() > 0) {
34293429
$environment->put('COOLIFY_URL', $fqdns->implode(','));
34303430

34313431
$urls = $fqdns->map(function ($fqdn) {
@@ -3436,7 +3436,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
34363436
add_coolify_default_environment_variables($resource, $environment, $resource->environment_variables);
34373437

34383438
$serviceLabels = $labels->merge($defaultLabels);
3439-
if (! $isDatabase && $fqdns?->count() > 0) {
3439+
if (! $isDatabase && $fqdns instanceof Collection && $fqdns->count() > 0) {
34403440
if ($isApplication) {
34413441
$shouldGenerateLabelsExactly = $resource->destination->server->settings->generate_exact_labels;
34423442
$uuid = $resource->uuid;
@@ -3667,7 +3667,9 @@ function convertComposeEnvironmentToArray($environment)
36673667
}
36683668
}
36693669
}
3670-
$convertedServiceVariables->put($key->value(), $value?->value() ?? null);
3670+
if ($key) {
3671+
$convertedServiceVariables->put($key->value(), $value?->value() ?? null);
3672+
}
36713673
}
36723674

36733675
return $convertedServiceVariables;

0 commit comments

Comments
 (0)