Skip to content

fix(amux): fall back to default base when AMUX_API_BASE is empty#13

Merged
duanbing merged 1 commit into
mainfrom
fix/amux-empty-base
Jun 23, 2026
Merged

fix(amux): fall back to default base when AMUX_API_BASE is empty#13
duanbing merged 1 commit into
mainfrom
fix/amux-empty-base

Conversation

@duanbing

Copy link
Copy Markdown

What

Restores the empty-AMUX_API_BASE fallback guard on main.

static ref AMUX_API_BASE: String = std::env::var("AMUX_API_BASE")
    .ok()
    .filter(|s| !s.is_empty())                       // ← restored
    .unwrap_or_else(|| "https://api.amux.ai".to_string());

Why

main currently uses the naive form:

std::env::var("AMUX_API_BASE").unwrap_or_else(|_| "https://api.amux.ai".to_string())

unwrap_or_else only fires on Err (var missing). An env var set to the empty string returns Ok("") and slips through, leaving AMUX_API_BASE = "" — a broken base URL. That's exactly what docker-compose produces with AMUX_API_BASE: ${AMUX_API_BASE:-} when the host var is unset.

The fix shipped on feat/amux-seedance (cff4cfb) but was lost when the amux provider was squash-merged to main as #12 (1e9dc55). This cherry-picks just that commit back onto main so the default wins on an empty value as well as a missing one.

Context

Consumed downstream by RouterBase/RouterBase#143 (submodule bump). Once this lands on main, a future RouterBase pin can track the submodule's main cleanly instead of the feat/amux-seedance SHA.

🤖 Generated with Claude Code

env::var returns Ok("") for an env var set to an empty string (as
docker-compose passes ${AMUX_API_BASE:-} when unset), which would yield
an empty base URL. Filter empties so https://api.amux.ai still wins.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the Contributor License Agreement (CLA) and hereby sign the CLA.


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@duanbing duanbing merged commit 2b89eaa into main Jun 23, 2026
6 of 7 checks passed
@duanbing duanbing deleted the fix/amux-empty-base branch June 23, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant