A file-based way to set tuning knobs without recompiling. urus is a
library, so it never presumes a config path or reads the environment — the
binary hands the text in:
- Config::with_toml_str(&str) -> Result<Config, ConfigError>: sparse overlay
onto an existing Config (built with the addr the binary chose). Only keys
present are applied; durations are integer seconds; unknown keys are a
hard error (deny_unknown_fields) so a typo is loud, not a silent no-op.
- Scope: the four slowloris knobs (head_timeout_secs, body_timeout_secs,
body_burst_bytes, body_stall_timeout_secs). Migrating the rest of Config
into the file is a separate, additive job — TomlOverrides just grows.
- Feature `config-file = ["dep:serde", "dep:toml"]`; the optional serde dep
gains the derive feature. The default build is unchanged (deps + code are
all gated).
- examples/serve_toml.rs (required-features = ["config-file"]): a `--config
PATH` demo with no presumed default location. plain_serve and its env
vars are left untouched.
Tests (feature-gated): empty keeps defaults, partial overrides only named,
full overrides all, unknown key errors, malformed errors. 84 lib with the
feature / 79 without; clippy --lib clean both ways; e2e smoke serves 200
from a file and rejects an unknown key loudly.