#env-var #configuration #settings #toml-config #environment #env

okcodes-config

Layered configuration system for Rust applications

4 releases

0.14.3 May 5, 2024
0.14.2 May 5, 2024
0.14.1 Apr 17, 2024
0.14.0 Apr 17, 2024

#474 in Configuration

Download history 2/week @ 2024-07-21 23/week @ 2024-07-28 9/week @ 2024-09-22 2/week @ 2024-09-29

173 downloads per month

MIT/Apache

150KB
3.5K SLoC

okcodes-config

Just a clone of config created to test opened and non-merged PRs on that project. This crate is unstable since early features will be tested here, the original config crate should be used.


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
  • String literals in well-known formats
  • Another Config instance
  • Files: TOML, JSON, YAML, INI, RON, JSON5 and custom ones defined with Format trait
  • 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.9–4MB
~77K SLoC