← Projects

mp-config

Layered, typed configuration for Rust modelled on MicroProfile Config: explicit source precedence, profiles, expressions and diagnostics that show exactly where each value came from.

Availability

Use mp-config from source as a Git dependency. It isn't published on crates.io. Requires Rust 1.85 or later.

Details

Values come from Java-style properties files, TOML, environment variables with relaxed name mapping, or your own sources. Every source has an ordinal; higher ordinals win, and an empty value deletes a property. Profile-specific keys use %profile.name, and values can reference each other with ${name} or ${name:default}.

A ConfigProperties derive builds typed, nested structs with prefixes, defaults and renaming, and converts strings to Rust types, including durations such as 250ms or 5m.

Config::explain lists every candidate for a key: which source offered it, its ordinal and profile, and whether it was selected, shadowed or deleted. Precedence surprises are quick to track down.