rtb-config
Part of the phpboyscout Rust toolkit: small, framework-free crates extracted from rust-tool-base.
Typed, layered configuration backed by figment. Declare a
serde::Deserialize struct, layer embedded defaults, user files, and
prefixed env vars over it, and read atomically swapped Arc snapshots.
There are no get_string("foo.bar") dynamic accessors, and there will not be.
use Config;
use Deserialize;
let cfg = builder
.embedded_default
.env_prefixed
.build?;
let current = cfg.get;
assert_eq!;
Two optional features, both off by default: hot-reload (a debounced file
watcher that reloads on change) and mutable (Config::schema() and
Config::write(), for config set / schema / validate style subcommands).
- Docs: https://config.rust.phpboyscout.uk, with a tutorial, how-to guides, reference, and what it does not do
- API reference: https://docs.rs/rtb-config
- Crate: https://crates.io/crates/rtb-config
Development
just ci runs the full local gate (fmt, clippy, nextest, doc, deny) with
every feature enabled, as the merge-request pipeline does.
Tests include a cucumber BDD suite (tests/bdd.rs). Releases are cut by
colophon from Conventional Commits, so do not tag manually.
License
MIT