Skip to content

Commit afbdd2e

Browse files
committed
fix: parser
1 parent b0e6014 commit afbdd2e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

bootstrap/helpers/shared.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3484,6 +3484,16 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
34843484
$value = $value->after('?');
34853485
}
34863486
if ($originalValue->value() === $value->value()) {
3487+
// This means the variable does not have a default value, so it needs to be created in Coolify
3488+
$parsedKeyValue = replaceVariables($value);
3489+
$resource->environment_variables()->where('key', $parsedKeyValue)->where($nameOfId, $resource->id)->firstOrCreate([
3490+
'key' => $parsedKeyValue,
3491+
$nameOfId => $resource->id,
3492+
], [
3493+
'is_build_time' => false,
3494+
'is_preview' => false,
3495+
]);
3496+
34873497
continue;
34883498
}
34893499
$resource->environment_variables()->where('key', $key)->where($nameOfId, $resource->id)->firstOrCreate([
@@ -3576,6 +3586,13 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
35763586
if ($environment->count() > 0) {
35773587
$environment = $environment->filter(function ($value, $key) {
35783588
return ! str($key)->startsWith('SERVICE_FQDN_');
3589+
})->map(function ($value, $key) {
3590+
// if value is empty, set it to null so if you set the environment variable in the .env file (Coolify's UI), it will used
3591+
if (str($value)->isEmpty()) {
3592+
$value = null;
3593+
}
3594+
3595+
return $value;
35793596
});
35803597
}
35813598
$serviceLabels = $labels->merge($defaultLabels);

0 commit comments

Comments
 (0)