More Configuration

More Configuration is a configuration library for Rust.
You may be looking for:
Features
This crate provides the following features:
- default - Abstractions for configuration, including the cmd, env, and mem features
- all - Includes all features
- binder - Bind a configuration to strongly-typed values and structs
- chained - Chain multiple configuration providers
- cmd - Configuration provided by command-line arguments
- env - Configuration provided by environment variables
- derive - Enables full and partial configuration deserialization using serde
- ini - Configuration provided by an *.ini file
- json - Configuration provided by a *.json file
- mem - Configuration provided by in-memory data
- typed - Configuration provided by strongly-typed, in-memory data
- xml - Configuration provided by a *.xml file
- yaml - Configuration provided by a *.yaml file
Configuration in Action
Consider the following demo.json file:
The configuration can be loaded, merged, and accessed from multiple sources:
use *;
use Error;
Raw configuration values can be used, but they are much more interesting when we data bind them to strongly-typed values.
The first letter of JSON configuration keys are normalized to uppercase.
use *;
use Deserialize;
use ;
Examples
Basic
A simple demonstration application is provided that combines in-memory settings, a demo.json file, and allows command line arguments. Run it with:
To highlight overriding configuration via the command line, run it with:
Partial Updates
A variant of the demonstration application is provided that illustrates how to support partial configuration binding.
Minimum Supported Rust Version
When increasing the minimum supported Rust version (MSRV), the new version must have been released at least six months ago. The current MSRV is 1.79.
License
This project is licensed under the MIT license.