fix is required on shared variables

This commit is contained in:
peaklabs-dev
2024-10-18 12:29:33 +02:00
parent b75c2dc604
commit 1d2e9b6946

View File

@@ -112,14 +112,20 @@ class Show extends Component
$this->validate();
}
if ($this->env->is_required && str($this->env->real_value)->isEmpty()) {
if (! $this->isSharedVariable && $this->env->is_required && str($this->env->real_value)->isEmpty()) {
$oldValue = $this->env->getOriginal('value');
$this->env->value = $oldValue;
$this->dispatch('error', 'Required environment variable cannot be empty.');
return;
}
$this->serialize();
if ($this->isSharedVariable) {
unset($this->env->is_required);
}
$this->env->save();
$this->dispatch('success', 'Environment variable updated.');
$this->dispatch('envsUpdated');