Skip to content

Commit b41e896

Browse files
committed
Fix port parsing in test-db
1 parent 7e9f6ca commit b41e896

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

backend/app/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ def test_db():
4949
from urllib.parse import urlparse
5050

5151
parsed = urlparse(DATABASE_URL)
52+
port = parsed.port or 5432
5253

53-
conn_str = f"host={parsed.hostname} port={parsed.port} dbname={parsed.path[1:]} user={parsed.username} password={parsed.password}"
54+
conn_str = f"host={parsed.hostname} port={port} dbname={parsed.path[1:]} user={parsed.username} password={parsed.password}"
5455

5556
for mode in ["disable", "allow", "prefer", "require"]:
5657
try:

0 commit comments

Comments
 (0)