fn web_vault_from_api_url(api_url: &str) -> StringExpand description
Derive the web-vault base from an API URL when no web-vault/server URL is configured (the
bw login --server and cloud paths). Pure so it can be unit-tested without a live client.
- Single-domain deployment: the API lives at
<web-vault>/api(the suffixbw login --serverappends), so a trailing/apiis stripped to recover the web vault. - Split-domain deployment (all Bitwarden cloud regions, and the standard self-host convention):
the API is served from an
api.host that does not serve the web-vault SPA, so the leadingapi.host label is rewritten tovault.(https://api.bitwarden.com->https://vault.bitwarden.com,https://api.bitwarden.eu->https://vault.bitwarden.eu). - Any other shape is treated as its own web vault.
This is a heuristic (see the web_vault_url TODO): a deployment whose API host neither ends in
/api nor begins with api. cannot be mapped and will fall through to being used as-is. Such
deployments should set bw config server --web-vault <url> for correct links.