#configuration #environment #env #settings

config-maint

Layered configuration system for Rust applications. (Maintenance fork)

1 unstable release

Uses old Rust 2015

0.11.0 Mar 13, 2021

#814 in Configuration

MIT/Apache

105KB
3K SLoC

config-rs-maint

Layered configuration system for Rust applications (with strong support for [12-factor] applications).

Note

This is a maintenance fork of config-rs because the upstream maintainer(s) are unresponsive.

I will maintain this fork as I see fit, but contributions are welcome. Bugfixes and new features are explicitely welcome here.

As soon as upstream is responsive again, I hope I can work with them to include all patches landed here into upstream.

License

config-rs is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.


lib.rs:

Config organizes hierarchical or layered configurations for Rust applications.

Config lets you set a set of default parameters and then extend them via merging in configuration from a variety of sources:

  • Environment variables
  • Another Config instance
  • Remote configuration: etcd, Consul
  • Files: JSON, YAML, TOML, HJSON
  • Manual, programmatic override (via a .set method on the Config instance)

Additionally, Config supports:

  • Live watching and re-reading of configuration files
  • Deep access into the merged configuration via a path syntax
  • Deserialization via serde of the configuration or any subset defined via a path

See the examples for general usage information.

Dependencies

~1–2MB
~40K SLoC