Skip to content

Commit

Permalink
enabler(backends): allow ssl string parameters in PostgreSQL URL (enc…
Browse files Browse the repository at this point in the history
…ode#575)

The underlying library asyncpg accepts string values in the ssl
parameter. The old code only accepted the values true and false, which
are converted to boolean.
  • Loading branch information
Exagone313 committed Nov 28, 2023
1 parent 2d05618 commit 600e56a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion databases/backends/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ 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()]
ssl_lower = ssl.lower()
if ssl_lower == "true":
kwargs["ssl"] = True
elif ssl_lower == "false":
kwargs["ssl"] = False

kwargs.update(self._options)

Expand Down

0 comments on commit 600e56a

Please sign in to comment.