Files
Nexus/server/infrastructure/agent_url.py
T
2026-07-08 22:31:31 +08:00

12 lines
439 B
Python

"""Build Agent HTTP URLs — use HTTPS when Nexus API base URL is HTTPS."""
from server.config import settings
def agent_url(host: str, port: int, path: str) -> str:
"""Agent endpoint URL on a managed host (health, exec, etc.)."""
scheme = "https" if (settings.API_BASE_URL or "").lower().startswith("https://") else "http"
if not path.startswith("/"):
path = f"/{path}"
return f"{scheme}://{host}:{port}{path}"