Repository navigation
feat: make console, proxy, and endpoint hosts configurable - #684
Conversation
Console links, pod proxy URLs, and load-balancer fallback URLs were built from hardcoded hosts, so they ignored the existing RUNPOD_CONSOLE_URL and RUNPOD_ENDPOINT_BASE_URL overrides. - Add runpod/_hosts.py: console_url(), proxy_url(), endpoint_domain() - RUNPOD_CONSOLE_URL now applies to rp console links, and is read at call time for the login URL instead of at import - New RUNPOD_PROXY_DOMAIN (default proxy.runpod.net) for task calls and rp pod URLs - rp endpoint run derives the load-balancer host from RUNPOD_ENDPOINT_BASE_URL when the API omits requestUrls.base Defaults are unchanged.
- Compare the exact proxy URL list instead of a substring check. - Patch runpod.endpoint_url_base by string target so the tests no longer import runpod both ways.
There was a problem hiding this comment.
🟡 Changes recommended
Endpoint URL resolution uses a stale host when the environment variable changes after import and produces malformed URLs when its initial value is blank.
1 open issue
What changed in this PR
This PR centralizes service-host resolution so CLI links, login URLs, task requests, and endpoint fallbacks can use configurable hosts rather than hardcoded public domains.
Changes:
- Adds shared helpers for console URLs, proxy URLs, and endpoint domains.
- Updates CLI and app call sites to use those helpers.
- Adds helper and call-site tests for host overrides and default behavior.
| File | Description |
|---|---|
tests/test_hosts.py |
Tests host helpers, defaults, and overrides. |
tests/test_cli/test_pod_command.py |
Tests proxy overrides in pod URLs. |
tests/test_cli/test_endpoint_command.py |
Tests the configured load-balancer fallback domain. |
tests/test_cli/test_console.py |
Tests console-link overrides. |
tests/test_apps/test_tasks.py |
Tests task proxy-domain overrides. |
tests/test_apps/test_auth.py |
Tests call-time console overrides for login. |
runpod/rp_cli/pod.py |
Uses the shared proxy URL helper. |
runpod/rp_cli/endpoint.py |
Derives the load-balancer fallback domain. |
runpod/rp_cli/console.py |
Builds endpoint links from the console helper. |
runpod/apps/tasks.py |
Uses configurable task proxy URLs. |
runpod/apps/targets.py |
Delegates endpoint-domain resolution to the shared helper. |
runpod/apps/auth.py |
Resolves the console URL when generating login links. |
runpod/_hosts.py |
Introduces shared service-host helpers. |
Review effort: Balanced
briandconnelly
left a comment
There was a problem hiding this comment.
Fixes recommended before merge.
Endpoint host resolution should be fixed because it does not provide the advertised call-time overrides or blank-value defaults. Tests were read, not run.
⚠️ Worth fixing
- Resolve endpoint overrides at call time with defaults
Runtime overrides still direct fallback calls to the public service, while blank configurations break load-balanced calls lackingrequestUrls.base.
What changed
The pull request centralizes console, pod proxy, and endpoint domain resolution in runpod/_hosts.py and updates SDK and CLI call sites to use it. It adds helper and call-site tests for host overrides.
👾 Reviewed by review-agent (GPT-6.1 Sol) on behalf of briandconnelly
Commit 94ebfe0 · 1 inline comment
endpoint_domain() read runpod.endpoint_url_base, which is set once at import. Setting RUNPOD_ENDPOINT_BASE_URL after import had no effect, and a blank value at import produced an empty domain. Read RUNPOD_ENDPOINT_BASE_URL on each call (stripped, blank treated as unset), then fall back to a non-blank runpod.endpoint_url_base for programmatic configuration, then to the public default.
KAJdev
left a comment
There was a problem hiding this comment.
should have a document or notion doc or something internal with a snippet to easily switch between dev and prod hosts

Summary
Some URLs were built from hardcoded hosts and so ignored the existing host overrides:
rpconsole links (rp_cli/console.py)console.runpod.ioRUNPOD_CONSOLE_URLapps/auth.py)RUNPOD_CONSOLE_URL, read once at importRUNPOD_CONSOLE_URL, read on each callapps/tasks.py)<pod>-8080.proxy.runpod.netRUNPOD_PROXY_DOMAIN(new)rp pod getURLs (rp_cli/pod.py)proxy.runpod.netRUNPOD_PROXY_DOMAINrp endpoint runload-balancer fallback (rp_cli/endpoint.py)<id>.api.runpod.aiRUNPOD_ENDPOINT_BASE_URLAll of these now go through a small
runpod/_hosts.pymodule:console_url(),proxy_url()andendpoint_domain(). It reads the env vars on each call, so a value set afterimport runpodstill takes effect. Blank values fall back to the defaults.apps/targets._lb_domainnow uses the same helper.With none of these env vars set, every URL is the same as before.
Test plan
tests/test_hosts.py: defaults, overrides, and blank values falling back to the defaultmake quality-check: 2746 passed, 94.29% coverage;runpod/_hosts.pyat 100%