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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Refactor environment variable saving logic.
Andras Bacsai8f5b08493182
diff --git a/app/Http/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Http/Livewire/Project/Shared/EnvironmentVariable/All.phpindex b1fa237e04..3f8b73f7b6 100644--- a/app/Http/Livewire/Project/Shared/EnvironmentVariable/All.php+++ b/app/Http/Livewire/Project/Shared/EnvironmentVariable/All.php@@ -55,12 +55,17 @@ class All extends Component{if ($isPreview) {$variables = parseEnvFormatToArray($this->variablesPreview);+ $this->resource->environment_variables_preview()->whereNotIn('key', array_keys($variables))->delete();} else {$variables = parseEnvFormatToArray($this->variables);+ $this->resource->environment_variables()->whereNotIn('key', array_keys($variables))->delete();}foreach ($variables as $key => $variable) {- $found = $this->resource->environment_variables()->where('key', $key)->first();- $foundPreview = $this->resource->environment_variables_preview()->where('key', $key)->first();+ if ($isPreview) {+ $found = $this->resource->environment_variables_preview()->where('key', $key)->first();+ } else {+ $found = $this->resource->environment_variables()->where('key', $key)->first();+ }if ($found) {if ($found->is_shown_once) {continue;@@ -68,14 +73,6 @@ class All extends Component$found->value = $variable;$found->save();continue;- }- if ($foundPreview) {- if ($foundPreview->is_shown_once) {- continue;- }- $foundPreview->value = $variable;- $foundPreview->save();- continue;} else {$environment = new EnvironmentVariable();$environment->key = $key;