Fix environment variable generation in ApplicationDeploymentJob.php

This commit is contained in:
Andras Bacsai 2024-04-25 14:15:44 +02:00
parent cd7489c569
commit cd7272d00a

View File

@ -718,10 +718,11 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
if ($env->version === '4.0.0-beta.239') { if ($env->version === '4.0.0-beta.239') {
$real_value = $env->real_value; $real_value = $env->real_value;
} else { } else {
$real_value = escapeEnvVariables($env->real_value); if ($env->is_literal) {
} $real_value = '\'' . $real_value . '\'';
if ($env->is_literal) { } else {
$real_value = '\'' . $real_value . '\''; $real_value = escapeEnvVariables($env->real_value);
}
} }
$envs->push($env->key . '=' . $real_value); $envs->push($env->key . '=' . $real_value);
} }
@ -755,8 +756,8 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
} else { } else {
$real_value = escapeEnvVariables($env->real_value); $real_value = escapeEnvVariables($env->real_value);
} }
$envs->push($env->key . '=' . $real_value);
} }
$envs->push($env->key . '=' . $real_value);
} }
// Add PORT if not exists, use the first port as default // Add PORT if not exists, use the first port as default
if ($this->application->environment_variables->filter(fn ($env) => Str::of($env)->startsWith('PORT'))->isEmpty()) { if ($this->application->environment_variables->filter(fn ($env) => Str::of($env)->startsWith('PORT'))->isEmpty()) {