✨ Populate docker_compose_domains for dockercompose apps

Add logic to populate docker_compose_domains in applicationParser
for dockercompose build packs, ensuring proper domain handling
for KEY-based SERVICE_FQDN variables.
This commit is contained in:
Tobias Thiele
2026-03-30 14:59:20 +02:00
parent 61f47cc7ee
commit 7f46b2ed71
3 changed files with 169 additions and 3 deletions
+22
View File
@@ -504,6 +504,28 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'is_preview' => false,
]);
}
// Also populate docker_compose_domains for dockercompose apps (mirrors Path 1 at lines 601-627)
if ($resource->build_pack === 'dockercompose') {
$normalizedFqdnFor = str($fqdnFor)->replace('-', '_')->replace('.', '_')->value();
$serviceExists = false;
foreach ($services as $serviceNameKey => $svc) {
if (str($serviceNameKey)->replace('-', '_')->replace('.', '_')->value() === $normalizedFqdnFor) {
$serviceExists = true;
break;
}
}
if ($serviceExists) {
$domains = collect(json_decode(data_get($resource, 'docker_compose_domains'))) ?? collect([]);
$domainExists = data_get($domains->get($normalizedFqdnFor), 'domain');
if (is_null($domainExists)) {
$domainValue = $fqdn;
$domains->put($normalizedFqdnFor, ['domain' => $domainValue]);
$resource->docker_compose_domains = $domains->toJson();
$resource->save();
}
}
}
}
}