refactor: Improve environment variable handling in shared.php

This commit is contained in:
Andras Bacsai
2024-09-09 10:16:12 +02:00
parent 40347744e0
commit 84093afaf6

View File

@@ -3074,19 +3074,17 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
$fqdnFor = null; $fqdnFor = null;
} }
// Lets save the magic value to the environment variables // Lets save the magic value to the environment variables
if (! $originalValue->startsWith('/')) { if ($key->startsWith('SERVICE_')) {
if ($key->startsWith('SERVICE_')) { $originalValue = $key;
$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,
]);
} }
$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,
]);
} }
} }
} }