MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / parse_database_endpoint

Function parse_database_endpoint

start_webui.py:28–39  ·  view source on GitHub ↗
(database_url: str)

Source from the content-addressed store, hash-verified

26
27
28def parse_database_endpoint(database_url: str) -> tuple[str, int] | None:
29 normalized = str(database_url or "").strip()
30 if not normalized.startswith(("postgres://", "postgresql://", "postgresql+psycopg://")):
31 return None
32
33 parsed = urlparse(normalized)
34 host = parsed.hostname
35 if not host:
36 return None
37
38 port = parsed.port or 5432
39 return host, port
40
41
42def can_connect_tcp(host: str, port: int, timeout_seconds: float = 1.5) -> bool:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected