Skip to content

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.

feat(ssl): new modes for MongoDB and get `caCert` and `mountPath` correctly

peaklabs-devbd33f65c0a26
diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.php
index 911b74f550..08d45a4ee8 100644
--- a/app/Livewire/Project/Database/Mongodb/General.php
+++ b/app/Livewire/Project/Database/Mongodb/General.php
@@ -39,7 +39,7 @@ class General extends Component
'database.is_log_drain_enabled' => 'nullable|boolean',
'database.custom_docker_run_options' => 'nullable',
'database.enable_ssl' => 'boolean',
- 'database.ssl_mode' => 'nullable|string|in:allowSSL,preferSSL,requireSSL,verifyCA,verifyFull',
+ 'database.ssl_mode' => 'nullable|string|in:allow,prefer,require,verify-ca,verify-full',
];
protected $validationAttributes = [
@@ -170,10 +170,7 @@ class General extends Component
return;
}
- $caCertificate = SslCertificate::where('server_id', $this->server->id)
- ->where('resource_type', null)
- ->where('resource_id', null)
- ->first();
+ $caCert = SslCertificate::where('server_id', $existingCert->server_id)->where('is_ca_certificate', true)->first();
SslHelper::generateSslCertificate(
commonName: $existingCert->common_name,
@@ -181,10 +178,10 @@ class General extends Component
resourceType: $existingCert->resource_type,
resourceId: $existingCert->resource_id,
serverId: $existingCert->server_id,
- caCert: $caCertificate->ssl_certificate,
- caKey: $caCertificate->ssl_private_key,
+ caCert: $caCert->ssl_certificate,
+ caKey: $caCert->ssl_private_key,
configurationDir: $existingCert->configuration_dir,
- mountPath: '/etc/mongo/certs',
+ mountPath: $existingCert->mount_path,
);
$this->dispatch('success', 'SSL certificates have been regenerated. Please restart the database for changes to take effect.');
diff --git a/resources/views/livewire/project/database/mongodb/general.blade.php b/resources/views/livewire/project/database/mongodb/general.blade.php
index b648845251..c2dcea140c 100644
--- a/resources/views/livewire/project/database/mongodb/general.blade.php
+++ b/resources/views/livewire/project/database/mongodb/general.blade.php
@@ -92,11 +92,11 @@
<x-forms.select id="database.ssl_mode" label="SSL Mode"
wire:model.live="database.ssl_mode" instantSave="instantSaveSSL"
helper="Choose the SSL verification mode for MongoDB connections">
- <option value="allowSSL">allowSSL</option>
- <option value="preferSSL">preferSSL</option>
- <option value="requireSSL">requireSSL</option>
- <option value="verifyCA">verifyCA</option>
- <option value="verifyFull">verifyFull</option>
+ <option value="allow">allow</option>
+ <option value="prefer">prefer</option>
+ <option value="require">require</option>
+ <option value="verify-ca">verify-ca</option>
+ <option value="verify-full">verify-full</option>
</x-forms.select>
@endif
</div>