Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

dynamic-config

Hot-reloadable, lock-free application configuration for Rust, behind one attribute. Built on figment.

Why

Configuration in a long-running service has three awkward properties at once: it comes from several sources with a precedence order, it is read on nearly every request from many threads, and it should be changeable without a restart.

Doing that by hand means a RwLock<Config> on the read path, a bespoke file watcher, and a reload that must not take the process down when someone saves a broken file. This crate is all three.

configfigmentGo's Viperdynamic-config
Layered sources
Hot reload
Lock-free readsnot thread-safe
Reload keeps last good config
Typed struct APIpartial
Async: await config changescallback

The loader is figment — layered providers, profile selection and loose typing of environment values are problems it already solves well. What this crate adds is everything around it: the attribute, the lock-free snapshot, the watcher, and a reload that cannot take the process down.

The shape of the crate

Three mandatory dependenciesfigment, serde, arc-swap. Every format, client, crypto stack and runtime is behind a feature or in a companion crate
#![forbid(unsafe_code)]in every crate here, checked by CI rather than trusted
MSRV 1.71and every feature that raises it says so, verified against real toolchains
No global singletoneach configuration type owns its storage; there is no Config::get() returning something a library set
no_stda separate crate for microcontrollers: no filesystem, no allocator, no runtime

Contributing and security

docs/CONTRIBUTOR-ONBOARDING.md is a tour of every crate and module — what each does and where you would change it. CONTRIBUTING.md has what a change should carry and what is load-bearing enough to argue about. SECURITY.md states the properties this crate tries to keep — and the ones it explicitly does not — along with how to report a vulnerability privately.

just check runs what CI runs; just containers adds the suites that need a Docker daemon.

License

MIT