fix(application): clear Docker Compose specific data when switching away from dockercompose

This commit is contained in:
Andras Bacsai
2025-08-18 11:31:14 +02:00
parent 0a29c6374c
commit 460198bb05
2 changed files with 17 additions and 0 deletions

View File

@@ -312,6 +312,18 @@ class General extends Component
if ($this->application->build_pack === 'dockercompose') { if ($this->application->build_pack === 'dockercompose') {
$this->application->fqdn = null; $this->application->fqdn = null;
$this->application->settings->save(); $this->application->settings->save();
} else {
// Clear Docker Compose specific data when switching away from dockercompose
if ($this->application->getOriginal('build_pack') === 'dockercompose') {
$this->application->docker_compose_domains = null;
$this->application->docker_compose_raw = null;
// Remove SERVICE_FQDN_* and SERVICE_URL_* environment variables
$this->application->environment_variables()->where('key', 'LIKE', 'SERVICE_FQDN_%')->delete();
$this->application->environment_variables()->where('key', 'LIKE', 'SERVICE_URL_%')->delete();
$this->application->environment_variables_preview()->where('key', 'LIKE', 'SERVICE_FQDN_%')->delete();
$this->application->environment_variables_preview()->where('key', 'LIKE', 'SERVICE_URL_%')->delete();
}
} }
if ($this->application->build_pack === 'static') { if ($this->application->build_pack === 'static') {
$this->application->ports_exposes = $this->ports_exposes = 80; $this->application->ports_exposes = $this->ports_exposes = 80;

View File

@@ -635,6 +635,11 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
} else { } else {
$domains = collect(json_decode(data_get($resource, 'docker_compose_domains'))) ?? collect([]); $domains = collect(json_decode(data_get($resource, 'docker_compose_domains'))) ?? collect([]);
} }
// Only process domains for dockercompose applications to prevent SERVICE variable recreation
if ($resource->build_pack !== 'dockercompose') {
$domains = collect([]);
}
$fqdns = data_get($domains, "$serviceName.domain"); $fqdns = data_get($domains, "$serviceName.domain");
// Generate SERVICE_FQDN & SERVICE_URL for dockercompose // Generate SERVICE_FQDN & SERVICE_URL for dockercompose
if ($resource->build_pack === 'dockercompose') { if ($resource->build_pack === 'dockercompose') {