Expand description
Config resolution — layer 5 of dsp-cli/ADR-0008.
The four-layer stack from dsp-cli/ADR-0007: flag → env var → .env (CWD) →
fail. .env is loaded via dotenvy::dotenv() at startup; no
hard-coded default server.
By the time Config::resolve is called, the chain has already collapsed
to a single Option<&str>: clap’s env = "DSP_SERVER" attribute merged
the flag and env-var tiers; dotenvy::dotenv() in main populated the
env from .env before clap ran. This function handles only the final
two cases: expand a shortcut or literal, or fail.
It also validates the expanded value’s scheme: a non-local http://
server is refused, because every authenticated command sends a bearer
token that would otherwise cross the network in cleartext. --server local (http://0.0.0.0:3333) and other loopback/localhost addresses
are exempt — a bearer token never leaves the machine. --allow-insecure-server
/ DSP_ALLOW_INSECURE_SERVER overrides the refusal.
A value containing a control character is refused on any scheme, and that refusal is not overridable.
Re-exports§
pub use auth_cache::AuthCache;pub use token::ResolvedToken;pub use token::TokenOrigin;pub use token::resolve_token;
Modules§
- auth_
cache - On-disk token cache at
~/.config/dsp-cli/auth.toml. See dsp-cli/ADR-0007 and dsp-cli/ADR-0012. - token
- Token resolution — resolves the effective bearer token from env or cache.
Structs§
- Config
- Resolved configuration for a single command invocation.