fix(deployment): enhance COOLIFY_URL and COOLIFY_FQDN variable generation for better compatibility
This commit is contained in:
@@ -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} ";
|
||||
|
@@ -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 {
|
||||
|
@@ -3716,10 +3716,13 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
||||
}
|
||||
// Add COOLIFY_FQDN & COOLIFY_URL to environment
|
||||
if (! $isDatabase && $fqdns instanceof Collection && $fqdns->count() > 0) {
|
||||
$coolifyEnvironments->put('COOLIFY_URL', $fqdns->implode(','));
|
||||
$fqdnsWithoutPort = $fqdns->map(function ($fqdn) {
|
||||
return str($fqdn)->after('://')->before(':')->prepend(str($fqdn)->before('://')->append('://'));
|
||||
});
|
||||
$coolifyEnvironments->put('COOLIFY_URL', $fqdnsWithoutPort->implode(','));
|
||||
|
||||
$urls = $fqdns->map(function ($fqdn) {
|
||||
return str($fqdn)->replace('http://', '')->replace('https://', '');
|
||||
return str($fqdn)->replace('http://', '')->replace('https://', '')->before(':');
|
||||
});
|
||||
$coolifyEnvironments->put('COOLIFY_FQDN', $urls->implode(','));
|
||||
}
|
||||
|
Reference in New Issue
Block a user