newparser parser parsing parser parse

This commit is contained in:
Andras Bacsai
2024-09-07 20:57:56 +02:00
parent 8b3eed5895
commit 4611332a8f

View File

@@ -2924,7 +2924,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
// parse environments first // parse environments first
$allMagicEnvironments = collect([]); $allMagicEnvironments = collect([]);
ray()->clearAll();
foreach ($services as $serviceName => $service) { foreach ($services as $serviceName => $service) {
$magicEnvironments = collect([]); $magicEnvironments = collect([]);
$image = data_get_str($service, 'image'); $image = data_get_str($service, 'image');
@@ -3388,48 +3387,10 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
return ! str($value)->startsWith('SERVICE_'); return ! str($value)->startsWith('SERVICE_');
}); });
// foreach ($normalEnvironments as $key => $value) {
// $key = str($key);
// $value = str($value);
// if ($value->startsWith('$') || $value->contains('${')) {
// if ($value->contains('${')) {
// $value = $value->after('${')->before('}');
// }
// $value = str(replaceVariables(str($value)));
// if ($value->contains(':-')) {
// $key = $value->before(':');
// $value = $value->after(':-');
// } elseif ($value->contains('-')) {
// $key = $value->before('-');
// $value = $value->after('-');
// } elseif ($value->contains(':?')) {
// $key = $value->before(':');
// $value = $value->after(':?');
// } elseif ($value->contains('?')) {
// $key = $value->before('?');
// $value = $value->after('?');
// } else {
// $key = $value;
// $value = null;
// }
// ray($key, $value);
// $resource->environment_variables()->where('key', $key)->where($nameOfId, $resource->id)->firstOrCreate([
// 'key' => $key,
// $nameOfId => $resource->id,
// ], [
// 'value' => $value,
// 'is_build_time' => false,
// 'is_preview' => false,
// ]);
// }
// }
foreach ($normalEnvironments as $key => $value) { foreach ($normalEnvironments as $key => $value) {
$key = str($key); $key = str($key);
$originalKey = $key;
$value = str($value); $value = str($value);
$parsedValue = str(replaceVariables(str($value))); $parsedValue = str(replaceVariables(str($value)));
// ray($key, $value, $parsedValue);
if ($key->value() === $parsedValue->value()) { if ($key->value() === $parsedValue->value()) {
$value = null; $value = null;