This commit is contained in:
Andras Bacsai 2024-08-23 20:55:32 +02:00
parent eece96e717
commit 2a9a2dd7c4

View File

@ -2113,10 +2113,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
return collect([]); return collect([]);
} }
} elseif ($resource->getMorphClass() === 'App\Models\Application') { } elseif ($resource->getMorphClass() === 'App\Models\Application') {
$isSameDockerComposeFile = false;
if ($resource->dockerComposePrLocation() === $resource->dockerComposeLocation()) {
$isSameDockerComposeFile = true;
}
try { try {
$yaml = Yaml::parse($resource->docker_compose_raw); $yaml = Yaml::parse($resource->docker_compose_raw);
} catch (\Exception $e) { } catch (\Exception $e) {
@ -2831,13 +2827,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
'configs' => $topLevelConfigs->toArray(), 'configs' => $topLevelConfigs->toArray(),
'secrets' => $topLevelSecrets->toArray(), 'secrets' => $topLevelSecrets->toArray(),
]; ];
if ($isSameDockerComposeFile) {
$resource->docker_compose_raw = Yaml::dump($yaml, 10, 2); $resource->docker_compose_raw = Yaml::dump($yaml, 10, 2);
$resource->docker_compose = Yaml::dump($finalServices, 10, 2); $resource->docker_compose = Yaml::dump($finalServices, 10, 2);
} else {
$resource->docker_compose_raw = Yaml::dump($yaml, 10, 2);
$resource->docker_compose = Yaml::dump($finalServices, 10, 2);
}
$resource->save(); $resource->save();
return collect($finalServices); return collect($finalServices);