refactor: Update Docker Compose parsing function to convert service variables to key-value pairs

This commit is contained in:
Andras Bacsai 2024-08-26 10:51:01 +02:00
parent bfc538b6ed
commit 7fd06a49db
2 changed files with 6 additions and 3 deletions

View File

@ -2120,6 +2120,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
$yaml = data_forget($yaml, 'services.*.volumes.*.content');
$resource->docker_compose_raw = Yaml::dump($yaml, 10, 2);
$resource->docker_compose = Yaml::dump($finalServices, 10, 2);
$resource->save();
$resource->saveComposeConfigs();
@ -2842,8 +2843,10 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
'configs' => $topLevelConfigs->toArray(),
'secrets' => $topLevelSecrets->toArray(),
];
$resource->docker_compose_raw = Yaml::dump($yaml, 10, 2);
$resource->docker_compose = Yaml::dump($finalServices, 10, 2);
$resource->docker_compose_raw = Yaml::dump($yaml, 10, 2);
$resource->docker_compose = Yaml::dump($finalServices, 10, 2);
data_forget($resource, 'environment_variables');
data_forget($resource, 'environment_variables_preview');
$resource->save();
return collect($finalServices);

View File

@ -33,7 +33,7 @@
</div>
<div class="flex items-center justify-center gap-2 text-xs font-bold">
<a class="hover:underline"
href="{{ route('project.resource.create', ['project_uuid' => $project->uuid, 'environment_name' => $project->default_environment()]) }}">
href="{{ route('project.resource.create', ['project_uuid' => $project->uuid, 'environment_name' => data_get($project, 'default_environment()', 'production')]) }}">
<span class="p-2 font-bold">+ Add Resource</span>
</a>
<a class="hover:underline"