fix: do not overwrite hardcoded variables if they rely on another variable

This commit is contained in:
Andras Bacsai 2024-07-10 15:53:46 +02:00
parent f35700c9ee
commit 491bb93e95

View File

@ -1384,10 +1384,12 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
} }
$parsedServiceVariables->put('COOLIFY_CONTAINER_NAME', "$serviceName-{$resource->uuid}"); $parsedServiceVariables->put('COOLIFY_CONTAINER_NAME', "$serviceName-{$resource->uuid}");
$parsedServiceVariables = $parsedServiceVariables->map(function ($value, $key) use ($envs_from_coolify) { $parsedServiceVariables = $parsedServiceVariables->map(function ($value, $key) use ($envs_from_coolify) {
if (! str($value)->startsWith('$')) {
$found_env = $envs_from_coolify->where('key', $key)->first(); $found_env = $envs_from_coolify->where('key', $key)->first();
if ($found_env) { if ($found_env) {
return $found_env->value; return $found_env->value;
} }
}
return $value; return $value;
}); });