Skip to content

Commit

Permalink
Improve sql ssl options
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsil committed Nov 29, 2023
1 parent 1a02288 commit 3b9c922
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion databasez/backends/aiopg.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _get_connection_kwargs(self) -> dict:
if max_size is not None:
kwargs["maxsize"] = int(max_size)
if ssl is not None:
kwargs["ssl"] = {"true": True, "false": False}[ssl.lower()]
kwargs["ssl"] = {"true": True, "false": False}.get(ssl.lower(), ssl.lower())

for key, value in self._options.items():
# Coerce 'min_size' and 'max_size' for consistency.
Expand Down
2 changes: 1 addition & 1 deletion databasez/backends/asyncmy.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _get_connection_kwargs(self) -> dict:
if pool_recycle is not None:
kwargs["pool_recycle"] = int(pool_recycle)
if ssl is not None:
kwargs["ssl"] = {"true": True, "false": False}[ssl.lower()]
kwargs["ssl"] = {"true": True, "false": False}.get(ssl.lower(), ssl.lower())

for key, value in self._options.items():
# Coerce 'min_size' and 'max_size' for consistency.
Expand Down
2 changes: 1 addition & 1 deletion databasez/backends/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _get_connection_kwargs(self) -> dict:
if pool_recycle is not None:
kwargs["pool_recycle"] = int(pool_recycle)
if ssl is not None:
kwargs["ssl"] = {"true": True, "false": False}[ssl.lower()]
kwargs["ssl"] = {"true": True, "false": False}.get(ssl.lower(), ssl.lower())

kwargs.update(
{
Expand Down
2 changes: 1 addition & 1 deletion databasez/backends/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _get_connection_kwargs(self) -> dict:
if pool_recycle is not None:
kwargs["pool_recycle"] = int(pool_recycle)
if ssl is not None:
kwargs["ssl"] = {"true": True, "false": False}[ssl.lower()]
kwargs["ssl"] = {"true": True, "false": False}.get(ssl.lower(), ssl.lower())

for key, value in self._options.items():
# Coerce 'min_size' and 'max_size' for consistency.
Expand Down
2 changes: 1 addition & 1 deletion databasez/backends/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _get_connection_kwargs(self) -> dict:
if max_size is not None:
kwargs["max_size"] = int(max_size)
if ssl is not None:
kwargs["ssl"] = {"true": True, "false": False}[ssl.lower()]
kwargs["ssl"] = {"true": True, "false": False}.get(ssl.lower(), ssl.lower())

kwargs.update(self._options)

Expand Down

0 comments on commit 3b9c922

Please sign in to comment.