-
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
While the app created with the template works with a DATABASE_URL like postgresql://USERNAME:PASSWORD@/DATABASE_NAME?host=HOST1,HOST2,HOST3&port=PORT1,PORT2,PORT3&target_session_attrs=primary, the prestart.sh script does not work correctly when DATABASE_URL contains multiple hosts (e.g., a Postgres URI with multiple nodes for HA/failover).
This is because the command
DB_HOST=$(python -c "from urllib.parse import urlparse; print(urlparse('${DATABASE_URL}').netloc.split('@')[-1]);")
returns the entire comma-separated host list (or empty value) and nc is then called with the whole comma-separated string as the hostname, causing the connection check to fail.
The script's host parsing logic should be updated to handle multiple hosts by parsing out the first available host from the URI and checking it, or loop over all nodes in the URI until one is reachable.
Metadata
Metadata
Assignees
Labels
No labels