From 0ff7c468c8c8b7257f654a5c8948cdb54ccddd13 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 3 Feb 2025 15:44:15 +0100 Subject: [PATCH] fix(ui): skip SERVICE_FQDN and SERVICE_URL variables during update --- app/Livewire/Project/Shared/EnvironmentVariable/All.php | 4 ++++ .../project/shared/environment-variable/all.blade.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php index 80156bf65..35e585c82 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php @@ -138,6 +138,7 @@ class All extends Component private function handleBulkSubmit() { $variables = parseEnvFormatToArray($this->variables); + $this->deleteRemovedVariables(false, $variables); $this->updateOrCreateVariables(false, $variables); @@ -189,6 +190,9 @@ class All extends Component private function updateOrCreateVariables($isPreview, $variables) { foreach ($variables as $key => $value) { + if (str($key)->startsWith('SERVICE_FQDN') || str($key)->startsWith('SERVICE_URL')) { + continue; + } $method = $isPreview ? 'environment_variables_preview' : 'environment_variables'; $found = $this->resource->$method()->where('key', $key)->first(); diff --git a/resources/views/livewire/project/shared/environment-variable/all.blade.php b/resources/views/livewire/project/shared/environment-variable/all.blade.php index 8723f926b..a5f0fae90 100644 --- a/resources/views/livewire/project/shared/environment-variable/all.blade.php +++ b/resources/views/livewire/project/shared/environment-variable/all.blade.php @@ -8,7 +8,7 @@ {{ $view === 'normal' ? 'Developer view' : 'Normal view (required to set variables at build time)' }} + wire:click='switch'>{{ $view === 'normal' ? 'Developer view' : 'Normal view' }}
Environment variables (secrets) for this resource.
@if ($this->resourceClass === 'App\Models\Application' && data_get($this->resource, 'build_pack') !== 'dockercompose') @@ -41,9 +41,9 @@ $requiredEmptyVars = $resource->environment_variables->filter(function ($env) { return $env->is_required && empty($env->value); }); + $otherVars = $resource->environment_variables->diff($requiredEmptyVars); @endphp - @forelse ($requiredEmptyVars->merge($otherVars) as $env)