Crate config

source ·
Expand description

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.


  • pub use crate::builder::ConfigBuilder;
  • pub use crate::builder::AsyncConfigBuilder;



  • A prioritized configuration repository. It maintains a set of configuration sources, fetches values to populate those, and provides them according to the source’s priority.
  • An environment source collects a dictionary of environment variables values into a hierarchical config Value type. We have to be aware how the config tree is created from the environment dictionary, therefore we are mindful about prefixes for the environment keys, level separators, encoding form (kebab, snake case) etc.
  • A configuration source backed up by a file.
  • Describes a file sourced from a file
  • Describes a file sourced from a string
  • A configuration value.


  • Defines the type of casing a string can be.
  • Represents all possible errors that can occur when working with configuration.
  • File formats provided by the library.
  • Underlying kind of the configuration value.


  • Describes a generic source of configuration properties capable of using an async runtime.
  • Describes where the file is sourced
  • An extension of Format trait.
  • Describes a format of configuration source data
  • Describes a generic source of configuration properties.

Type Aliases§