Skip to content

Commit

Permalink
👷 add --mysql-ssl-{cert,key,ca} options
Browse files Browse the repository at this point in the history
  • Loading branch information
frugan-dev committed Jun 4, 2024
1 parent 9af779f commit 03516c3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Options:
-W, --without-data Do not transfer table data, DDL only.
-h, --mysql-host TEXT MySQL host. Defaults to localhost.
-P, --mysql-port INTEGER MySQL port. Defaults to 3306.
--mysql-ssl-cert PATH Path to SSL certificate file.
--mysql-ssl-key PATH Path to SSL key file.
--mysql-ssl-ca PATH Path to SSL CA certificate file.
-S, --skip-ssl Disable MySQL connection encryption.
-c, --chunk INTEGER Chunk reading/writing SQL records
-l, --log-file PATH Log file
Expand Down
3 changes: 3 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Connection Options

- ``-h, --mysql-host TEXT``: MySQL host. Defaults to localhost.
- ``-P, --mysql-port INTEGER``: MySQL port. Defaults to 3306.
- ``--mysql-ssl-cert PATH``: Path to SSL certificate file.
- ``--mysql-ssl-key PATH``: Path to SSL key file.
- ``--mysql-ssl-ca PATH``: Path to SSL CA certificate file.
- ``-S, --skip-ssl``: Disable MySQL connection encryption.

Other Options
Expand Down
9 changes: 9 additions & 0 deletions src/mysql_to_sqlite3/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
)
@click.option("-h", "--mysql-host", default="localhost", help="MySQL host. Defaults to localhost.")
@click.option("-P", "--mysql-port", type=int, default=3306, help="MySQL port. Defaults to 3306.")
@click.option("--mysql-ssl-cert", type=click.Path(), help="Path to SSL certificate file.")
@click.option("--mysql-ssl-key", type=click.Path(), help="Path to SSL key file.")
@click.option("--mysql-ssl-ca", type=click.Path(), help="Path to SSL CA certificate file.")
@click.option("-S", "--skip-ssl", is_flag=True, help="Disable MySQL connection encryption.")
@click.option(
"-c",
Expand Down Expand Up @@ -142,6 +145,9 @@ def cli(
without_data: bool,
mysql_host: str,
mysql_port: int,
mysql_ssl_cert: t.Optional[str],
mysql_ssl_key: t.Optional[str],
mysql_ssl_ca: t.Optional[str],
skip_ssl: bool,
chunk: int,
log_file: t.Union[str, "os.PathLike[t.Any]"],
Expand Down Expand Up @@ -171,6 +177,9 @@ def cli(
without_data=without_data,
mysql_host=mysql_host,
mysql_port=mysql_port,
mysql_ssl_cert=mysql_ssl_cert,
mysql_ssl_key=mysql_ssl_key,
mysql_ssl_ca=mysql_ssl_ca,
mysql_ssl_disabled=skip_ssl,
chunk=chunk,
json_as_text=json_as_text,
Expand Down
9 changes: 9 additions & 0 deletions src/mysql_to_sqlite3/transporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ def __init__(self, **kwargs: tx.Unpack[MySQLtoSQLiteParams]) -> None:

self._without_data = kwargs.get("without_data") or False

self._mysql_ssl_ca = kwargs.get("mysql_ssl_ca") or None

self._mysql_ssl_cert = kwargs.get("mysql_ssl_cert") or None

self._mysql_ssl_key = kwargs.get("mysql_ssl_key") or None

self._mysql_ssl_disabled = kwargs.get("mysql_ssl_disabled") or False

self._current_chunk_number = 0
Expand Down Expand Up @@ -123,6 +129,9 @@ def __init__(self, **kwargs: tx.Unpack[MySQLtoSQLiteParams]) -> None:
password=self._mysql_password,
host=self._mysql_host,
port=self._mysql_port,
ssl_ca=self._mysql_ssl_ca,
ssl_cert=self._mysql_ssl_cert,
ssl_key=self._mysql_ssl_key,
ssl_disabled=self._mysql_ssl_disabled,
)
if isinstance(_mysql_connection, MySQLConnectionAbstract):
Expand Down

0 comments on commit 03516c3

Please sign in to comment.