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
chore(ui): improve valid until handling
peaklabs-devfd5b7492f810
diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.phpindex e52d8d65e4..f0e3d064ef 100644--- a/app/Livewire/Project/Database/Postgresql/General.php+++ b/app/Livewire/Project/Database/Postgresql/General.php@@ -25,6 +25,8 @@ class General extends Componentpublic ?string $db_url_public = null;+ public $certificateValidUntil = null;+public function getListeners(){return [@@ -78,6 +80,14 @@ class General extends Component$this->db_url = $this->database->internal_db_url;$this->db_url_public = $this->database->external_db_url;$this->server = data_get($this->database, 'destination.server');++ $existingCert = SslCertificate::where('resource_type', $this->database->getMorphClass())+ ->where('resource_id', $this->database->id)+ ->first();++ if ($existingCert) {+ $this->certificateValidUntil = $existingCert->valid_until;+ }}public function instantSaveAdvanced()@@ -112,12 +122,6 @@ class General extends Componentpublic function regenerateSslCertificate(){try {- if (! $this->database->enable_ssl) {- $this->dispatch('error', 'SSL is not enabled for this database.');-- return;- }-$server = $this->database->destination->server;$existingCert = SslCertificate::where('resource_type', $this->database->getMorphClass())diff --git a/resources/views/livewire/project/database/postgresql/general.blade.php b/resources/views/livewire/project/database/postgresql/general.blade.phpindex 4ca4817ad7..8b9ca45f99 100644--- a/resources/views/livewire/project/database/postgresql/general.blade.php+++ b/resources/views/livewire/project/database/postgresql/general.blade.php@@ -75,38 +75,33 @@</div><div class="flex flex-col gap-2"><div class="flex items-center justify-between py-2">- <div class="flex flex-col gap-1">+ <div class="flex items-center justify-between w-full"><h3>SSL Configuration</h3>@if($database->enable_ssl)- @php- $cert = \App\Models\SslCertificate::where('resource_type', $database->getMorphClass())- ->where('resource_id', $database->id)- ->first();- @endphp- @if($cert)- <span class="text-sm">Valid until:- @if(now()->gt($cert->valid_until))- <span class="text-red-500">{{ $cert->valid_until->format('d.m.Y H:i:s') }} - Expired</span>- @elseif(now()->addDays(30)->gt($cert->valid_until))- <span class="text-red-500">{{ $cert->valid_until->format('d.m.Y H:i:s') }} - Expiring soon</span>- @else- <span>{{ $cert->valid_until->format('d.m.Y H:i:s') }}</span>- @endif- </span>- @endif+ <x-modal-confirmation+ title="Regenerate SSL Certificates"+ buttonTitle="Regenerate SSL Certificates"+ :actions="['The SSL certificate of this database will be regenerated.','You must restart the database after regenerating the certificate to start using the new certificate.']"+ submitAction="regenerateSslCertificate"+ :confirmWithText="false"+ :confirmWithPassword="false"+ />@endif</div>- @if($database->enable_ssl)- <x-modal-confirmation- title="Regenerate SSL Certificates"- buttonTitle="Regenerate SSL Certificates"- :actions="['The SSL certificate of this database will be regenerated.','You must restart the database after regenerating the certificate to start using the new certificate.']"- submitAction="regenerateSslCertificate"- :confirmWithText="false"- :confirmWithPassword="false"- />- @endif</div>+ @if($database->enable_ssl)+ <span class="text-sm">Valid until:+ @if(now()->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired</span>+ @elseif(now()->addDays(30)->gt($certificateValidUntil))+ <span class="text-red-500">{{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon</span>+ @else+ <span>{{ $certificateValidUntil->format('d.m.Y H:i:s') }}</span>+ @endif+ </span>+ @endif+ </div>+ <div class="flex flex-col gap-2"><div class="flex flex-col gap-2"><x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />@if($database->enable_ssl)