pub fn turn_config() -> Option<TurnConfig>Expand description
Resolve TURN server config, highest priority first:
- An explicit
MECHA10_WEBRTC_TURN_URL/_USERNAME/_CREDENTIALenv var set at runtime (today’s existing override behavior - seeTurnServerConfig::from_env,packages/video/src/webrtc/connection.rs, andmecha10 dev’smaybe_inject_turn_credentials,packages/cli/src/handlers/dev/ops/spawn.rs). - The build-time-baked
option_env!default (LAB-1917).
Returns None when neither is present, so callers can fall through further to LAB-1915’s
runtime API fetch from mecha10-api (tier 3, not implemented here - this function only ever
resolves the first two tiers).
An empty URL - explicit or baked - is treated the same as unset (mirrors
TurnServerConfig::from_env’s explicit-side check), so a deployment with no TURN server
provisioned at all correctly falls through. The baked side matters in practice: a CI secret
that isn’t provisioned yet (${{ secrets.MECHA10_WEBRTC_TURN_URL }} on an unset repo secret)
still sets the env var cargo build sees to "" rather than leaving it unset, which would
otherwise bake in Some("") and incorrectly short-circuit tier 3.