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 sorting issue in save_environment_variables() function

Andras Bacsai7c0b98bb70ed
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 594b1e412c..4b4631de98 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -740,6 +740,9 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$envs->push("SOURCE_COMMIT=unknown");
}
}
+ $envs = $envs->sort(function ($a, $b) {
+ return strpos($a, '$') === false ? -1 : 1;
+ });
} else {
$this->env_filename = ".env";
foreach ($this->application->environment_variables as $env) {
@@ -783,7 +786,16 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
"ignore_errors" => true
]
);
- return;
+ } else {
+ $envs_base64 = base64_encode($envs->implode("\n"));
+ $this->execute_remote_command(
+ [
+ executeInDocker($this->deployment_uuid, "echo '$envs_base64' | base64 -d | tee $this->workdir/{$this->env_filename} > /dev/null")
+ ],
+ [
+ "echo '$envs_base64' | base64 -d | tee $this->configuration_dir/{$this->env_filename} > /dev/null"
+ ]
+ );
}
// $this->execute_remote_command([
// executeInDocker($this->deployment_uuid, "cat $this->workdir/.env 2>/dev/null || true"),
@@ -806,15 +818,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
// ]
// );
// }
- $envs_base64 = base64_encode($envs->implode("\n"));
- $this->execute_remote_command(
- [
- executeInDocker($this->deployment_uuid, "echo '$envs_base64' | base64 -d | tee $this->workdir/{$this->env_filename} > /dev/null")
- ],
- [
- "echo '$envs_base64' | base64 -d | tee $this->configuration_dir/{$this->env_filename} > /dev/null"
- ]
- );
+
}