fix(deployment): enhance COOLIFY_URL and COOLIFY_FQDN variable generation for better compatibility

This commit is contained in:
Andras Bacsai
2025-07-07 12:55:35 +02:00
parent e9ca8c3559
commit 085529dc63
3 changed files with 15 additions and 6 deletions

View File

@@ -1347,9 +1347,16 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$fqdn = $this->preview->fqdn;
}
if (isset($fqdn)) {
$this->coolify_variables .= "COOLIFY_FQDN={$fqdn} ";
$url = str($fqdn)->replace('http://', '')->replace('https://', '');
$this->coolify_variables .= "COOLIFY_URL={$url} ";
$fqdnWithoutPort = str($fqdn)->after('://')->before(':')->prepend(str($fqdn)->before('://')->append('://'));
$url = str($fqdn)->replace('http://', '')->replace('https://', '')->before(':');
if ((int) $this->application->compose_parsing_version >= 3) {
$this->coolify_variables .= "COOLIFY_URL={$fqdnWithoutPort} ";
$this->coolify_variables .= "COOLIFY_FQDN={$url} ";
} else {
$this->coolify_variables .= "COOLIFY_URL={$fqdnWithoutPort} ";
$this->coolify_variables .= "COOLIFY_FQDN={$url} ";
}
}
if (isset($this->application->git_branch)) {
$this->coolify_variables .= "COOLIFY_BRANCH={$this->application->git_branch} ";

View File

@@ -1264,7 +1264,6 @@ class Service extends BaseModel
foreach ($sorted as $env) {
$envs->push("{$env->key}={$env->real_value}");
}
ray($envs);
if ($envs->count() === 0) {
$commands[] = 'touch .env';
} else {