fix(core): project a reference's base_url on a bound requires

_target_url only resolved http_exposed deployments, so a `requires` with a
`bind` pointing at a `manager: none` reference (an external resource) injected
nothing. Return the reference's base_url, so binding an external endpoint into a
consumer's env works — e.g. litellm's vllm-payne reference → VLLM_API_BASE.
This commit is contained in:
2026-07-06 16:37:21 -07:00
parent 46778b7f2e
commit 1dace6c6a0

View File

@@ -516,6 +516,11 @@ def _target_url(config: CastleConfig, target_name: str) -> str | None:
dep = matches[0][1] if matches else None
if dep is None:
return None
# A reference (manager: none) carries its URL directly — that's what a bind to
# an external resource projects into the consumer's env.
base = getattr(dep, "base_url", None)
if base:
return base
expose = getattr(dep, "expose", None)
http = getattr(expose, "http", None) if expose else None
tport = http.internal.port if http else None