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
feat: required envs
Andras Bacsai88f1e58c6350
diff --git a/app/Livewire/Project/Service/Navbar.php b/app/Livewire/Project/Service/Navbar.phpindex 70b3b5db67..fa76ee26fb 100644--- a/app/Livewire/Project/Service/Navbar.php+++ b/app/Livewire/Project/Service/Navbar.php@@ -39,6 +39,7 @@ class Navbar extends Componentreturn ["echo-private:user.{$userId},ServiceStatusChanged" => 'serviceStarted',+ "envsUpdated" => '$refresh',];}diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php b/app/Livewire/Project/Shared/EnvironmentVariable/Show.phpindex 463ceecad1..0538a6bdb4 100644--- a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php+++ b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php@@ -37,6 +37,7 @@ class Show extends Component'env.is_literal' => 'required|boolean','env.is_shown_once' => 'required|boolean','env.real_value' => 'nullable',+ 'env.is_required' => 'required|boolean',];protected $validationAttributes = [@@ -46,6 +47,7 @@ class Show extends Component'env.is_multiline' => 'Multiline','env.is_literal' => 'Literal','env.is_shown_once' => 'Shown Once',+ 'env.is_required' => 'Required',];public function refresh()@@ -109,14 +111,14 @@ class Show extends Component} else {$this->validate();}- // if (str($this->env->value)->startsWith('{{') && str($this->env->value)->endsWith('}}')) {- // $type = str($this->env->value)->after('{{')->before('.')->value;- // if (! collect(SHARED_VARIABLE_TYPES)->contains($type)) {- // $this->dispatch('error', 'Invalid shared variable type.', 'Valid types are: team, project, environment.');-- // return;- // }- // }++ if ($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();$this->env->save();$this->dispatch('success', 'Environment variable updated.');diff --git a/app/Models/EnvironmentVariable.php b/app/Models/EnvironmentVariable.phpindex 9f8e4b342f..531c8fa40e 100644--- a/app/Models/EnvironmentVariable.php+++ b/app/Models/EnvironmentVariable.php@@ -44,7 +44,7 @@ class EnvironmentVariable extends Model'version' => 'string',];- protected $appends = ['real_value', 'is_shared'];+ protected $appends = ['real_value', 'is_shared', 'is_really_required'];protected static function booted(){@@ -130,6 +130,13 @@ class EnvironmentVariable extends Model);}+ protected function isReallyRequired(): Attribute+ {+ return Attribute::make(+ get: fn () => $this->is_required && str($this->real_value)->isEmpty(),+ );+ }+protected function isShared(): Attribute{return Attribute::make(diff --git a/app/Models/Service.php b/app/Models/Service.phpindex 0036a9fda4..16e11ecb6b 100644--- a/app/Models/Service.php+++ b/app/Models/Service.php@@ -1232,7 +1232,6 @@ class Service extends BaseModelpublic function environment_variables(): HasMany{-return $this->hasMany(EnvironmentVariable::class)->orderByRaw("LOWER(key) LIKE LOWER('SERVICE%') DESC, LOWER(key) ASC");}@@ -1316,4 +1315,20 @@ class Service extends BaseModelreturn $networks;}++ protected function isDeployable(): Attribute+ {+ return Attribute::make(+ get: function () {+ $envs = $this->environment_variables()->where('is_required', true)->get();+ foreach ($envs as $env) {+ if ($env->is_really_required) {+ return false;+ }+ }+ return true;+ }+ );+ }+}diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex cfdea81fbd..ea9d6ff3cb 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -3569,6 +3569,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int]);} else {if ($value->startsWith('$')) {+ $isRequired = false;if ($value->contains(':-')) {$value = replaceVariables($value);$key = $value->before(':');@@ -3583,11 +3584,13 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int$key = $value->before(':');$value = $value->after(':?');+ $isRequired = true;} elseif ($value->contains('?')) {$value = replaceVariables($value);$key = $value->before('?');$value = $value->after('?');+ $isRequired = true;}if ($originalValue->value() === $value->value()) {// This means the variable does not have a default value, so it needs to be created in Coolify@@ -3598,6 +3601,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int], ['is_build_time' => false,'is_preview' => false,+ 'is_required' => $isRequired,]);// Add the variable to the environment so it will be shown in the deployable compose file$environment[$parsedKeyValue->value()] = $resource->environment_variables()->where('key', $parsedKeyValue)->where($nameOfId, $resource->id)->first()->value;@@ -3611,6 +3615,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int'value' => $value,'is_build_time' => false,'is_preview' => false,+ 'is_required' => $isRequired,]);}diff --git a/database/migrations/2024_10_11_114331_add_required_env_variables.php b/database/migrations/2024_10_11_114331_add_required_env_variables.phpnew file mode 100644index 0000000000..4fde0c2bbf--- /dev/null+++ b/database/migrations/2024_10_11_114331_add_required_env_variables.php@@ -0,0 +1,28 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Database\Schema\Blueprint;+use Illuminate\Support\Facades\Schema;++return new class extends Migration+{+ /**+ * Run the migrations.+ */+ public function up(): void+ {+ Schema::table('environment_variables', function (Blueprint $table) {+ $table->boolean('is_required')->default(false);+ });+ }++ /**+ * Reverse the migrations.+ */+ public function down(): void+ {+ Schema::table('environment_variables', function (Blueprint $table) {+ $table->dropColumn('is_required');+ });+ }+};diff --git a/resources/views/livewire/project/service/navbar.blade.php b/resources/views/livewire/project/service/navbar.blade.phpindex 6ff297c61c..342c071d4f 100644--- a/resources/views/livewire/project/service/navbar.blade.php+++ b/resources/views/livewire/project/service/navbar.blade.php@@ -20,127 +20,143 @@</a><x-services.links :service="$service" /></nav>- <div class="flex flex-wrap order-first gap-2 items-center sm:order-last">- @if (str($service->status())->contains('running'))- <x-dropdown>- <x-slot:title>- Advanced- </x-slot>- <div class="dropdown-item" @click="$wire.dispatch('pullAndRestartEvent')">- <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" stroke-width="1.5"- stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">- <path stroke="none" d="M0 0h24v24H0z" fill="none" />- <path- d="M12.983 8.978c3.955 -.182 7.017 -1.446 7.017 -2.978c0 -1.657 -3.582 -3 -8 -3c-1.661 0 -3.204 .19 -4.483 .515m-2.783 1.228c-.471 .382 -.734 .808 -.734 1.257c0 1.22 1.944 2.271 4.734 2.74" />- <path- d="M4 6v6c0 1.657 3.582 3 8 3c.986 0 1.93 -.067 2.802 -.19m3.187 -.82c1.251 -.53 2.011 -1.228 2.011 -1.99v-6" />- <path d="M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4" />- <path d="M3 3l18 18" />+ @if ($service->isDeployable)+ <div class="flex flex-wrap order-first gap-2 items-center sm:order-last">+ @if (str($service->status())->contains('running'))+ <x-dropdown>+ <x-slot:title>+ Advanced+ </x-slot>+ <div class="dropdown-item" @click="$wire.dispatch('pullAndRestartEvent')">+ <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"+ stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"+ stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />+ <path+ d="M12.983 8.978c3.955 -.182 7.017 -1.446 7.017 -2.978c0 -1.657 -3.582 -3 -8 -3c-1.661 0 -3.204 .19 -4.483 .515m-2.783 1.228c-.471 .382 -.734 .808 -.734 1.257c0 1.22 1.944 2.271 4.734 2.74" />+ <path+ d="M4 6v6c0 1.657 3.582 3 8 3c.986 0 1.93 -.067 2.802 -.19m3.187 -.82c1.251 -.53 2.011 -1.228 2.011 -1.99v-6" />+ <path d="M4 12v6c0 1.657 3.582 3 8 3c3.217 0 5.991 -.712 7.261 -1.74m.739 -3.26v-4" />+ <path d="M3 3l18 18" />+ </svg>+ Pull Latest Images & Restart+ </div>+ </x-dropdown>+ <x-forms.button title="Restart" @click="$wire.dispatch('restartEvent')">+ <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+ <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"+ stroke-width="2">+ <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />+ <path d="M20 4v5h-5" />+ </g></svg>- Pull Latest Images & Restart- </div>- </x-dropdown>- <x-forms.button title="Restart" @click="$wire.dispatch('restartEvent')">- <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">- <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"- stroke-width="2">- <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />- <path d="M20 4v5h-5" />- </g>- </svg>- Restart- </x-forms.button>- <x-modal-confirmation title="Confirm Service Stopping?" buttonTitle="Stop" submitAction="stop"- :checkboxes="$checkboxes" :actions="[__('service.stop'), __('resource.non_persistent')]" :confirmWithText="false" :confirmWithPassword="false" step1ButtonText="Continue"- step2ButtonText="Stop Service" :dispatchEvent="true" dispatchEventType="stopEvent">- <x-slot:button-title>- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"- stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"- stroke-linejoin="round">- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>- <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">- </path>- <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">- </path>+ Restart+ </x-forms.button>+ <x-modal-confirmation title="Confirm Service Stopping?" buttonTitle="Stop" submitAction="stop"+ :checkboxes="$checkboxes" :actions="[__('service.stop'), __('resource.non_persistent')]" :confirmWithText="false" :confirmWithPassword="false"+ step1ButtonText="Continue" step2ButtonText="Stop Service" :dispatchEvent="true"+ dispatchEventType="stopEvent">+ <x-slot:button-title>+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"+ stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"+ stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>+ <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">+ </path>+ <path+ d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">+ </path>+ </svg>+ Stop+ </x-slot:button-title>+ </x-modal-confirmation>+ @elseif (str($service->status())->contains('degraded'))+ <button @click="$wire.dispatch('startEvent')" class="gap-2 button">+ <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+ <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"+ stroke-width="2">+ <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />+ <path d="M20 4v5h-5" />+ </g>+ </svg>+ Restart Degraded Services+ </button>+ <x-modal-confirmation title="Confirm Service Stopping?" buttonTitle="Stop" submitAction="stop"+ :checkboxes="$checkboxes" :actions="[__('service.stop'), __('resource.non_persistent')]" :confirmWithText="false" :confirmWithPassword="false"+ step1ButtonText="Continue" step2ButtonText="Stop Service" :dispatchEvent="true"+ dispatchEventType="stopEvent">+ <x-slot:button-title>+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"+ stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"+ stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>+ <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">+ </path>+ <path+ d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">+ </path>+ </svg>+ Stop+ </x-slot:button-title>+ </x-modal-confirmation>+ @elseif (str($service->status())->contains('exited'))+ <button wire:click='stop(true)' class="gap-2 button">+ <svg class="w-5 h-5" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">+ <path fill="red" d="M26 20h-6v-2h6zm4 8h-6v-2h6zm-2-4h-6v-2h6z" />+ <path fill="red"+ d="M17.003 20a4.895 4.895 0 0 0-2.404-4.173L22 3l-1.73-1l-7.577 13.126a5.699 5.699 0 0 0-5.243 1.503C3.706 20.24 3.996 28.682 4.01 29.04a1 1 0 0 0 1 .96h14.991a1 1 0 0 0 .6-1.8c-3.54-2.656-3.598-8.146-3.598-8.2Zm-5.073-3.003A3.11 3.11 0 0 1 15.004 20c0 .038.002.208.017.469l-5.9-2.624a3.8 3.8 0 0 1 2.809-.848ZM15.45 28A5.2 5.2 0 0 1 14 25h-2a6.5 6.5 0 0 0 .968 3h-2.223A16.617 16.617 0 0 1 10 24H8a17.342 17.342 0 0 0 .665 4H6c.031-1.836.29-5.892 1.803-8.553l7.533 3.35A13.025 13.025 0 0 0 17.596 28Z" /></svg>- Stop- </x-slot:button-title>- </x-modal-confirmation>- @elseif (str($service->status())->contains('degraded'))- <button @click="$wire.dispatch('startEvent')" class="gap-2 button">- <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">- <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"- stroke-width="2">- <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />- <path d="M20 4v5h-5" />- </g>- </svg>- Restart Degraded Services- </button>- <x-modal-confirmation title="Confirm Service Stopping?" buttonTitle="Stop" submitAction="stop"- :checkboxes="$checkboxes" :actions="[__('service.stop'), __('resource.non_persistent')]" :confirmWithText="false" :confirmWithPassword="false"- step1ButtonText="Continue" step2ButtonText="Stop Service" :dispatchEvent="true"- dispatchEventType="stopEvent">- <x-slot:button-title>- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"- stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"+ Force Cleanup Containers+ </button>+ <button @click="$wire.dispatch('startEvent')" class="gap-2 button">+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"+ stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"stroke-linejoin="round">- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>- <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">- </path>- <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">- </path>+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />+ <path d="M7 4v16l13 -8z" /></svg>- Stop- </x-slot:button-title>- </x-modal-confirmation>- @elseif (str($service->status())->contains('exited'))- <button wire:click='stop(true)' class="gap-2 button">- <svg class="w-5 h-5" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">- <path fill="red" d="M26 20h-6v-2h6zm4 8h-6v-2h6zm-2-4h-6v-2h6z" />- <path fill="red"- d="M17.003 20a4.895 4.895 0 0 0-2.404-4.173L22 3l-1.73-1l-7.577 13.126a5.699 5.699 0 0 0-5.243 1.503C3.706 20.24 3.996 28.682 4.01 29.04a1 1 0 0 0 1 .96h14.991a1 1 0 0 0 .6-1.8c-3.54-2.656-3.598-8.146-3.598-8.2Zm-5.073-3.003A3.11 3.11 0 0 1 15.004 20c0 .038.002.208.017.469l-5.9-2.624a3.8 3.8 0 0 1 2.809-.848ZM15.45 28A5.2 5.2 0 0 1 14 25h-2a6.5 6.5 0 0 0 .968 3h-2.223A16.617 16.617 0 0 1 10 24H8a17.342 17.342 0 0 0 .665 4H6c.031-1.836.29-5.892 1.803-8.553l7.533 3.35A13.025 13.025 0 0 0 17.596 28Z" />- </svg>- Force Cleanup Containers- </button>- <button @click="$wire.dispatch('startEvent')" class="gap-2 button">- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"- stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"- stroke-linejoin="round">- <path stroke="none" d="M0 0h24v24H0z" fill="none" />- <path d="M7 4v16l13 -8z" />- </svg>- Deploy- </button>- @else- <x-modal-confirmation title="Confirm Service Stopping?" buttonTitle="Stop" submitAction="stop"- :checkboxes="$checkboxes" :actions="[__('service.stop'), __('resource.non_persistent')]" :confirmWithText="false" :confirmWithPassword="false"- step1ButtonText="Continue" step2ButtonText="Stop Service" :dispatchEvent="true"- dispatchEventType="stopEvent">- <x-slot:button-title>- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"- stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"+ Deploy+ </button>+ @else+ <x-modal-confirmation title="Confirm Service Stopping?" buttonTitle="Stop" submitAction="stop"+ :checkboxes="$checkboxes" :actions="[__('service.stop'), __('resource.non_persistent')]" :confirmWithText="false" :confirmWithPassword="false"+ step1ButtonText="Continue" step2ButtonText="Stop Service" :dispatchEvent="true"+ dispatchEventType="stopEvent">+ <x-slot:button-title>+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"+ stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"+ stroke-linejoin="round">+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>+ <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">+ </path>+ <path+ d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">+ </path>+ </svg>+ Stop+ </x-slot:button-title>+ </x-modal-confirmation>+ <button @click="$wire.dispatch('startEvent')" class="gap-2 button">+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"+ stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"stroke-linejoin="round">- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>- <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">- </path>- <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">- </path>+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />+ <path d="M7 4v16l13 -8z" /></svg>- Stop- </x-slot:button-title>- </x-modal-confirmation>- <button @click="$wire.dispatch('startEvent')" class="gap-2 button">- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"- stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"- stroke-linejoin="round">- <path stroke="none" d="M0 0h24v24H0z" fill="none" />- <path d="M7 4v16l13 -8z" />- </svg>- Deploy- </button>- @endif- </div>+ Deploy+ </button>+ @endif+ </div>+ @else+ <div class="flex flex-wrap order-first gap-2 items-center sm:order-last">+ <div class="text-error">+ Unable to deploy. <a+ class="underline font-bold cursor-pointer"+ @click.prevent="activeTab = 'environment-variables'; window.location.hash = 'environment-variables'">+ Required environment variables missing.</a>+ </div>+ </div>+ @endif</div>@script<script>diff --git a/resources/views/livewire/project/shared/environment-variable/all.blade.php b/resources/views/livewire/project/shared/environment-variable/all.blade.phpindex 5e8aa7d63a..deb785caa1 100644--- a/resources/views/livewire/project/shared/environment-variable/all.blade.php+++ b/resources/views/livewire/project/shared/environment-variable/all.blade.php@@ -37,7 +37,14 @@<h3>Production Environment Variables</h3><div>Environment (secrets) variables for Production.</div></div>- @forelse ($resource->environment_variables as $env)+ @php+ $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)<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}":env="$env" :type="$resource->type()" />@emptydiff --git a/resources/views/livewire/project/shared/environment-variable/show.blade.php b/resources/views/livewire/project/shared/environment-variable/show.blade.phpindex 545f102f30..96d1331edc 100644--- a/resources/views/livewire/project/shared/environment-variable/show.blade.php+++ b/resources/views/livewire/project/shared/environment-variable/show.blade.php@@ -1,6 +1,11 @@<div><form wire:submit='submit'- class="flex flex-col items-center gap-4 p-4 bg-white border lg:items-start dark:bg-base dark:border-coolgray-300">+ @class([+ 'flex flex-col items-center gap-4 p-4 bg-white border lg:items-start dark:bg-base',+ 'border-error' => $env->is_really_required,+ 'dark:border-coolgray-300' => !$env->is_really_required,+ ])+ >@if ($isLocked)<div class="flex flex-1 w-full gap-2"><x-forms.input disabled id="env.key" />