From bbbd605f32b829b13b8b0ce50e5f1f721a3023e3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 12 Dec 2023 12:10:46 +0100 Subject: [PATCH] fix: comma in traefik custom labels --- app/Jobs/ApplicationDeploymentJob.php | 3 +-- app/Livewire/Project/Application/General.php | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index be38ee581..cafddfa82 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -874,12 +874,11 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted $environment_variables = $this->generate_environment_variables($ports); if (data_get($this->application, 'custom_labels')) { - ray(base64_decode($this->application->custom_labels)); $labels = collect(preg_split("/\r\n|\n|\r/", base64_decode($this->application->custom_labels))); $labels = $labels->filter(function ($value, $key) { return !Str::startsWith($value, 'coolify.'); }); - $this->application->custom_labels = base64_encode($labels); + $this->application->custom_labels = base64_encode($labels->implode("\n")); $this->application->save(); } else { $labels = collect(generateLabelsApplication($this->application, $this->preview)); diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index 3d68771f4..7587031fd 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -238,15 +238,12 @@ class General extends Component if ($this->application->publish_directory && $this->application->publish_directory !== '/') { $this->application->publish_directory = rtrim($this->application->publish_directory, '/'); } - $this->application->custom_labels = base64_encode($this->customLabels); - // if (gettype($this->customLabels) === 'string') { - // $this->customLabels = str($this->customLabels)->replace(',', "\n"); - // } - // $this->application->custom_labels = $this->customLabels->explode("\n")->implode(','); if ($this->application->build_pack === 'dockercompose') { $this->application->docker_compose_domains = json_encode($this->parsedServiceDomains); $this->parsedServices = $this->application->parseCompose(); } + + $this->application->custom_labels = base64_encode($this->customLabels); $this->application->save(); $showToaster && $this->dispatch('success', 'Application settings updated!'); } catch (\Throwable $e) {