c5store

One dynamic store for configuration and secrets.

C5Store is a unified store for configuration and secrets. It merges YAML and TOML files, applies environment variable overrides, decrypts secrets inline and hands the result back as typed Rust values or deserialized structs. Every value sits behind one dot-notation key path such as database.host.

Most applications pull settings from several places and end up passing raw maps around. C5Store gives you one place to read from and keeps track of where each value came from, so get_source(path) tells you which file, environment variable or provider set it. You read a single value with get_into::<T>(path), fill a struct from a section with get_into_struct::<T>(path) and scope all reads to a subtree with branch(path).

Any key can be overridden from the environment with a C5_SECTION__KEY=value variable. Secrets live in the config file under a .c5encval key holding the algorithm, the key name and the encrypted data; they are decrypted on load with the bundled base64 or ecies_x25519 decryptors, with keys read from files, environment variables or the systemd credential store.

Sections can be deferred to value providers, which load data from outside sources and can refresh it on a timer. Code that cares about a value can subscribe to it and react when it changes, without a restart.

[dependencies]
c5store = "0"
serde = { version = "1", features = ["derive"] }

Optional features add TOML parsing (toml), .env loading (dotenv) and a bootstrapper that fetches missing config files from a path, URL or Git repository (bootstrapper). Rust is the reference implementation; JavaScript and Java ports exist but do not match its feature set yet.

Licensed under MPL-2.0. Source at https://github.com/normano/c5store and API docs at https://docs.rs/c5store.