fix(ssl): remove mode selection for MariaDB as it is not supported
This commit is contained in:
@@ -40,7 +40,6 @@ class General extends Component
|
|||||||
'database.is_log_drain_enabled' => 'nullable|boolean',
|
'database.is_log_drain_enabled' => 'nullable|boolean',
|
||||||
'database.custom_docker_run_options' => 'nullable',
|
'database.custom_docker_run_options' => 'nullable',
|
||||||
'database.enable_ssl' => 'boolean',
|
'database.enable_ssl' => 'boolean',
|
||||||
'database.ssl_mode' => 'nullable|string|in:PREFERRED,REQUIRED,VERIFY_CA,VERIFY_IDENTITY',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $validationAttributes = [
|
protected $validationAttributes = [
|
||||||
@@ -57,7 +56,6 @@ class General extends Component
|
|||||||
'database.public_port' => 'Public Port',
|
'database.public_port' => 'Public Port',
|
||||||
'database.custom_docker_run_options' => 'Custom Docker Options',
|
'database.custom_docker_run_options' => 'Custom Docker Options',
|
||||||
'database.enable_ssl' => 'Enable SSL',
|
'database.enable_ssl' => 'Enable SSL',
|
||||||
'database.ssl_mode' => 'SSL Mode',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
@@ -147,7 +145,6 @@ class General extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->database->enable_ssl = $this->database->enable_ssl;
|
$this->database->enable_ssl = $this->database->enable_ssl;
|
||||||
$this->database->ssl_mode = $this->database->ssl_mode;
|
|
||||||
$this->database->save();
|
$this->database->save();
|
||||||
$this->dispatch('success', 'SSL configuration updated.');
|
$this->dispatch('success', 'SSL configuration updated.');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@@ -218,17 +218,7 @@ class StandaloneMariadb extends BaseModel
|
|||||||
protected function internalDbUrl(): Attribute
|
protected function internalDbUrl(): Attribute
|
||||||
{
|
{
|
||||||
return new Attribute(
|
return new Attribute(
|
||||||
get: function () {
|
get: fn () => "mysql://{$this->mariadb_user}:{$this->mariadb_password}@{$this->uuid}:3306/{$this->mariadb_database}",
|
||||||
$url = "mysql://{$this->mariadb_user}:{$this->mariadb_password}@{$this->uuid}:3306/{$this->mariadb_database}";
|
|
||||||
if ($this->enable_ssl) {
|
|
||||||
$url .= "?ssl-mode={$this->ssl_mode}";
|
|
||||||
if (in_array($this->ssl_mode, ['VERIFY_CA', 'VERIFY_IDENTITY'])) {
|
|
||||||
$url .= '&ssl-ca=/etc/ssl/certs/coolify-ca.crt';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $url;
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,15 +227,7 @@ class StandaloneMariadb extends BaseModel
|
|||||||
return new Attribute(
|
return new Attribute(
|
||||||
get: function () {
|
get: function () {
|
||||||
if ($this->is_public && $this->public_port) {
|
if ($this->is_public && $this->public_port) {
|
||||||
$url = "mysql://{$this->mariadb_user}:{$this->mariadb_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mariadb_database}";
|
return "mysql://{$this->mariadb_user}:{$this->mariadb_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mariadb_database}";
|
||||||
if ($this->enable_ssl) {
|
|
||||||
$url .= "?ssl-mode={$this->ssl_mode}";
|
|
||||||
if (in_array($this->ssl_mode, ['VERIFY_CA', 'VERIFY_IDENTITY'])) {
|
|
||||||
$url .= '&ssl-ca=/etc/ssl/certs/coolify-ca.crt';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@@ -97,15 +97,6 @@
|
|||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<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" />
|
<x-forms.checkbox id="database.enable_ssl" label="Enable SSL" wire:model.live="database.enable_ssl" instantSave="instantSaveSSL" />
|
||||||
@if($database->enable_ssl)
|
|
||||||
<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 MariaDB connections">
|
|
||||||
<option value="PREFERRED">PREFERRED</option>
|
|
||||||
<option value="REQUIRED">REQUIRED</option>
|
|
||||||
<option value="VERIFY_CA">VERIFY_CA</option>
|
|
||||||
<option value="VERIFY_IDENTITY">VERIFY_IDENTITY</option>
|
|
||||||
</x-forms.select>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user