From 84093afaf66536fa235107746a92fce1afe317e7 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 9 Sep 2024 10:16:12 +0200 Subject: [PATCH] refactor: Improve environment variable handling in shared.php --- bootstrap/helpers/shared.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 75c7a101c..4bc83d1c5 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -3074,19 +3074,17 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int $fqdnFor = null; } // Lets save the magic value to the environment variables - if (! $originalValue->startsWith('/')) { - if ($key->startsWith('SERVICE_')) { - $originalValue = $key; - } - $resource->environment_variables()->where('key', $originalValue->value())->where($nameOfId, $resource->id)->firstOrCreate([ - 'key' => $originalValue->value(), - $nameOfId => $resource->id, - ], [ - 'value' => $value, - 'is_build_time' => false, - 'is_preview' => false, - ]); + if ($key->startsWith('SERVICE_')) { + $originalValue = $key; } + $resource->environment_variables()->where('key', $originalValue->value())->where($nameOfId, $resource->id)->firstOrCreate([ + 'key' => $originalValue->value(), + $nameOfId => $resource->id, + ], [ + 'value' => $value, + 'is_build_time' => false, + 'is_preview' => false, + ]); } } }