Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit 600e56a

Browse files
author
Elouan Martinet
committed
enabler(backends): allow ssl string parameters in PostgreSQL URL (#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.
1 parent 2d05618 commit 600e56a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

databases/backends/postgres.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ def _get_connection_kwargs(self) -> dict:
5555
if max_size is not None:
5656
kwargs["max_size"] = int(max_size)
5757
if ssl is not None:
58-
kwargs["ssl"] = {"true": True, "false": False}[ssl.lower()]
58+
ssl_lower = ssl.lower()
59+
if ssl_lower == "true":
60+
kwargs["ssl"] = True
61+
elif ssl_lower == "false":
62+
kwargs["ssl"] = False
5963

6064
kwargs.update(self._options)
6165

0 commit comments

Comments
 (0)