Expand description
Tool-wide configuration: where Sendra’s config files live, how a project config overrides a global one, and what the result does to a request.
Two files, either or both of which may be absent:
- Project:
.sendra/config.yaml, found by walking up from the current directory the way git looks for.git, so running from a subdirectory of a project still finds the project’s config. - Global:
config.yamlunder the platform’s config directory — on Linux$XDG_CONFIG_HOME/sendra(i.e.~/.config/sendraby default), on macOS~/Library/Application Support/sendra, on Windows%APPDATA%\sendra. Seeglobal_config_path.
Project values override global values per key, not per file: a project
config that sets only a timeout still inherits the global default headers.
No config file anywhere is a perfectly ordinary state — everything falls
back to the hardcoded defaults in Config::default.
The schema stays small on purpose, and grows only as a feature actually
needs a new key — ConfigFile documents the current full set. This
module exists first to prove the resolution mechanism: every key
resolves through the same global-then-project, per-key merge_over.
Structs§
- Client
Cert File - The
client_cert:config key’s on-disk shape: a cert path and a key path, both plain strings so [resolve_client_cert_paths] can rewrite a relative one in place before it is ever turned into aPathBuf. - Config
- Resolved, ready-to-use configuration: every field decided, no
Options left. Built by merging whichever config files exist over the hardcoded defaults, so the rest of the crate never has to ask whether a file was found. - Config
File - One config file, exactly as it appears on disk.
Enums§
- Follow
Redirects - How a run treats an HTTP redirect: follow up to some maximum number of hops, or not at all.
Constants§
- DEFAULT_
MAX_ REDIRECTS - reqwest’s own default: up to 10 redirects in a chain before giving up.
Sendra keeps this as its default too, so a config that never mentions
follow_redirectsbehaves exactly as it always has. - DEFAULT_
TIMEOUT - Timeout applied when no config file sets one.
Functions§
- find_
project_ config - Walk up from
start_dirlooking for.sendra/config.yaml, returning the first one found. - global_
config_ path - Path to the global config file, or
Noneif the platform cannot say where config belongs (a daemon with no home directory, say) — in which case there is simply no global config.