revert .env changes

This commit is contained in:
Andras Bacsai 2024-04-18 06:55:47 +02:00
parent 144cdd11ec
commit a1b08ca037

View File

@ -741,7 +741,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
} }
} }
} else { } else {
$this->env_filename = ".env-coolify"; $this->env_filename = ".env";
foreach ($this->application->environment_variables as $env) { foreach ($this->application->environment_variables as $env) {
$real_value = $env->real_value; $real_value = $env->real_value;
if ($env->version === '4.0.0-beta.239') { if ($env->version === '4.0.0-beta.239') {
@ -785,27 +785,27 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$this->env_filename = null; $this->env_filename = null;
return; return;
} }
$this->execute_remote_command([ // $this->execute_remote_command([
executeInDocker($this->deployment_uuid, "cat $this->workdir/.env 2>/dev/null || true"), // executeInDocker($this->deployment_uuid, "cat $this->workdir/.env 2>/dev/null || true"),
"hidden" => true, // "hidden" => true,
"save" => "dotenv" // "save" => "dotenv"
]); // ]);
if (str($this->saved_outputs->get('dotenv'))->isNotEmpty()) { // if (str($this->saved_outputs->get('dotenv'))->isNotEmpty()) {
$base64_dotenv = base64_encode($this->saved_outputs->get('dotenv')->value()); // $base64_dotenv = base64_encode($this->saved_outputs->get('dotenv')->value());
$this->execute_remote_command( // $this->execute_remote_command(
[ // [
"echo '{$base64_dotenv}' | base64 -d | tee $this->configuration_dir/.env > /dev/null" // "echo '{$base64_dotenv}' | base64 -d | tee $this->configuration_dir/.env > /dev/null"
] // ]
); // );
} else { // } else {
$this->execute_remote_command( // $this->execute_remote_command(
[ // [
"command" => "rm -f $this->configuration_dir/.env", // "command" => "rm -f $this->configuration_dir/.env",
"hidden" => true, // "hidden" => true,
"ignore_errors" => true // "ignore_errors" => true
] // ]
); // );
} // }
$envs_base64 = base64_encode($envs->implode("\n")); $envs_base64 = base64_encode($envs->implode("\n"));
$this->execute_remote_command( $this->execute_remote_command(
[ [
@ -1281,21 +1281,23 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
] ]
] ]
]; ];
if (str($this->saved_outputs->get('dotenv'))->isNotEmpty()) { // if (str($this->saved_outputs->get('dotenv'))->isNotEmpty()) {
if (data_get($docker_compose, "services.{$this->container_name}.env_file")) { // if (data_get($docker_compose, "services.{$this->container_name}.env_file")) {
$docker_compose['services'][$this->container_name]['env_file'][] = '.env'; // $docker_compose['services'][$this->container_name]['env_file'][] = '.env';
} else { // } else {
$docker_compose['services'][$this->container_name]['env_file'] = ['.env']; // $docker_compose['services'][$this->container_name]['env_file'] = ['.env'];
} // }
} // }
// if ($this->env_filename) {
// if (data_get($docker_compose, "services.{$this->container_name}.env_file")) {
// $docker_compose['services'][$this->container_name]['env_file'][] = $this->env_filename;
// } else {
// $docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename];
// }
// }
if ($this->env_filename) { if ($this->env_filename) {
if (data_get($docker_compose, "services.{$this->container_name}.env_file")) { $docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename];
$docker_compose['services'][$this->container_name]['env_file'][] = $this->env_filename;
} else {
$docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename];
}
} }
if (!$this->custom_healthcheck_found) { if (!$this->custom_healthcheck_found) {
$docker_compose['services'][$this->container_name]['healthcheck'] = [ $docker_compose['services'][$this->container_name]['healthcheck'] = [
'test' => [ 'test' => [