⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-05-04 19:19:41 +02:00
.cargo chore: Ensure MSRV-aware resolver is used 2025-03-05 11:48:22 -06:00
examples docs(examples): Consoldate env examples 2026-03-17 08:48:01 -05:00
src chore: sync dependencies (monorepo) 2026-04-10 13:14:12 +02:00
tests/testsuite chore: Upgrade to 2024 edition 2026-03-12 14:36:17 -05:00
.gitignore No longer ignore Cargo.lock 2024-02-01 07:39:47 +01:00
.gitlint Add gitlint configuration file 2022-12-14 08:57:03 +01:00
.pre-commit-config.yaml chore(deps): Update pre-commit hook crate-ci/typos to v1.44.0 2026-03-01 02:42:00 +00:00
_typos.toml docs: Fix typos 2024-10-22 16:26:55 -05:00
Cargo.lock chore: sync dependencies (monorepo) 2026-04-06 15:20:13 +02:00
Cargo.toml Fix conflicting serde dependencies and update all local paths to git.sly.so 2026-05-04 19:19:41 +02:00
committed.toml chore: First step 2023-03-29 14:33:22 -05:00
CONTRIBUTING.md chore: Update from _rust/main template 2025-06-03 12:27:59 -05:00
deny.toml chore: Add license for libfuzzer 2025-09-18 13:39:37 -05:00
LICENSE-APACHE chore: First step 2023-03-29 14:33:22 -05:00
LICENSE-MIT chore: First step 2023-03-29 14:33:22 -05:00
README.md docs(readme): Include corn 2025-09-24 11:20:22 -05:00
release.toml chore: Update from '_rust/main' template 2024-10-22 16:19:45 -05:00

config-rs

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

Documentation License Crates Status

  • Set defaults
  • Set explicit values (to programmatically override)
  • Read from JSON, TOML, YAML, INI, RON, JSON5, CORN files
  • Read from environment
  • Loosely typed — Configuration values may be read in any supported type, as long as there exists a reasonable conversion
  • Access nested fields using a formatted path — Uses a subset of JSONPath; currently supports the child ( redis.port ) and subscript operators ( databases[0].name )

Please note that this library can not be used to write changed configuration values back to the configuration file(s)!

Usage

Feature flags

  • ini - Adds support for reading INI files
  • json - Adds support for reading JSON files
  • yaml - Adds support for reading YAML files
  • toml - Adds support for reading TOML files
  • ron - Adds support for reading RON files
  • json5 - Adds support for reading JSON5 files
  • corn - Adds support for reading Corn files

Support for custom formats

Library provides out of the box support for most renowned data formats such as JSON or Yaml. Nonetheless, it contains an extensibility point - a Format trait that, once implemented, allows seamless integration with library's APIs using custom, less popular or proprietary data formats.

See custom_file_format example for more information.

More

See the documentation or examples for more usage information.

License

Licensed under either of

at your option.