Skip to content

Commit f77de20

Browse files
committed
feat: allow remote skipping ssl for mysql/mariadb
1 parent efc338d commit f77de20

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

UPGRADING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ We aim to make upgrading between versions as smooth as possible, but sometimes i
44
This document will outline those steps. And as much as we try to cover all cases, we might miss some. If you come
55
across such a case, please let us know by [opening an issue][issues], or by adding it yourself and creating a pull request.
66

7+
## v0.8.1
8+
9+
* The `db_skip_ssl` configuration option was added to `environments.*`. This allows for skipping SSL when connecting to
10+
the remote database. This flag is only supported by MySQL and MariaDB.
11+
712
## v0.8.0
813

914
* The namespace for the `AnonymizeUsers` processor was changed. Make sure to update your config file accordingly:

config/environment-importer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
| - db_port: The database port.
2525
| - db_use_ssh: Whether to use an SSH tunnel to connect to the database.
2626
| - db_ssh_tunnel_port: The local port to use for the SSH tunnel.
27+
| - db_skip_ssl: Whether to skip SSL when connecting to the database. Only supported by MySQL/MariaDB.
2728
|
2829
*/
2930

@@ -43,6 +44,7 @@
4344
'db_port' => env('LEI_STAGING_DB_PORT', '3306'),
4445
'db_use_ssh' => (bool) env('LEI_STAGING_DB_USE_SSH', false),
4546
'db_ssh_tunnel_port' => env('LEI_STAGING_DB_SSH_TUNNEL_PORT', '3307'),
47+
'db_skip_ssl' => (bool) env('LEI_STAGING_DB_SKIP_SSL', false),
4648
],
4749

4850
'production' => [
@@ -60,6 +62,7 @@
6062
'db_port' => env('LEI_PRODUCTION_DB_PORT', '3306'),
6163
'db_use_ssh' => (bool) env('LEI_PRODUCTION_DB_USE_SSH', false),
6264
'db_ssh_tunnel_port' => env('LEI_PRODUCTION_DB_SSH_TUNNEL_PORT', '3307'),
65+
'db_skip_ssl' => (bool) env('LEI_PRODUCTION_DB_SKIP_SSL', false),
6366
],
6467
],
6568

src/Commands/ImportEnvironmentCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,20 @@ protected function getDatabaseDumpClient(bool $local = false): MySql
341341
};
342342

343343
/** @phpstan-ignore-next-line */
344-
return $db::create()
344+
$client = $db::create()
345345
->setHost($local ? DB::getConfig('host') : $this->getEnvironmentConfigValue('db_host'))
346346
->setDbName($local ? DB::getConfig('database') : $this->getEnvironmentConfigValue('db_name'))
347347
->setUserName($local ? DB::getConfig('username') : $this->getEnvironmentConfigValue('db_username'))
348348
->setPassword($local ? DB::getConfig('password') : $this->getEnvironmentConfigValue('db_password'))
349349
->setPort($port)
350350
->setDumpBinaryPath($this->getConfigValue('db_dump_binary_path', '/usr/bin'));
351+
352+
// Allow skipping SSL for MySQL/MariaDB connections if configured.
353+
if (!$local && $dbType === 'mysql' && $this->getConfigValue('db_skip_ssl', false)) {
354+
$client->setSkipSsl();
355+
}
356+
357+
return $client;
351358
}
352359

353360
/**

0 commit comments

Comments
 (0)