Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Fix environment variable generation in ApplicationDeploymentJob.php

Andras Bacsaif626d964c5c9
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 52afdd47ef..db64b65420 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -750,12 +750,13 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
if ($env->version === '4.0.0-beta.239') {
$real_value = $env->real_value;
} else {
- $real_value = escapeEnvVariables($env->real_value);
- }
- if ($env->is_literal) {
- $real_value = '\'' . $real_value . '\'';
+ if ($env->is_literal) {
+ $real_value = '\'' . $real_value . '\'';
+ } else {
+ $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
if ($this->application->environment_variables->filter(fn ($env) => Str::of($env)->startsWith('PORT'))->isEmpty()) {
@@ -1506,7 +1507,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
return $local_persistent_volumes_names;
}
- private function generate_environment_variables($ports)
+ /*private function generate_environment_variables($ports)
{
$environment_variables = collect();
if ($this->pull_request_id === 0) {
@@ -1524,8 +1525,10 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
}
if ($env->is_literal) {
$real_value = escapeDollarSign($real_value);
+ $environment_variables->push("$env->key='$real_value'");
+ } else {
+ $environment_variables->push("$env->key=$real_value");
}
- $environment_variables->push("$env->key=$real_value");
}
foreach ($this->application->nixpacks_environment_variables as $env) {
if ($env->version === '4.0.0-beta.239') {
@@ -1535,8 +1538,10 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
}
if ($env->is_literal) {
$real_value = escapeDollarSign($real_value);
+ $environment_variables->push("$env->key='$real_value'");
+ } else {
+ $environment_variables->push("$env->key=$real_value");
}
- $environment_variables->push("$env->key=$real_value");
}
} else {
foreach ($this->application->runtime_environment_variables_preview as $env) {
@@ -1547,8 +1552,10 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
}
if ($env->is_literal) {
$real_value = escapeDollarSign($real_value);
+ $environment_variables->push("$env->key='$real_value'");
+ } else {
+ $environment_variables->push("$env->key=$real_value");
}
- $environment_variables->push("$env->key=$real_value");
}
foreach ($this->application->nixpacks_environment_variables_preview as $env) {
if ($env->version === '4.0.0-beta.239') {
@@ -1558,8 +1565,10 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
}
if ($env->is_literal) {
$real_value = escapeDollarSign($real_value);
+ $environment_variables->push("$env->key='$real_value'");
+ } else {
+ $environment_variables->push("$env->key=$real_value");
}
- $environment_variables->push("$env->key=$real_value");
}
}
// Add PORT if not exists, use the first port as default
@@ -1577,8 +1586,9 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$environment_variables->push("SOURCE_COMMIT=unknown");
}
}
+ ray($environment_variables->all());
return $environment_variables->all();
- }
+ }*/
private function generate_healthcheck_commands()
{