README.md
1# config-rs
2
3
4[](https://travis-ci.org/mehcode/config-rs)
5[](https://crates.io/crates/config)
6[](https://docs.rs/config)
7
8> Layered configuration system for Rust applications (with strong support for [12-factor] applications).
9
10[12-factor]: https://12factor.net/config
11
12 - Set defaults
13 - Set explicit values (to programmatically override)
14 - Read from [JSON], [TOML], [YAML], [INI], [RON], [JSON5] files
15 - Read from environment
16 - Loosely typed — Configuration values may be read in any supported type, as long as there exists a reasonable conversion
17 - Access nested fields using a formatted path — Uses a subset of JSONPath; currently supports the child ( `redis.port` ) and subscript operators ( `databases[0].name` )
18
19[JSON]: https://github.com/serde-rs/json
20[TOML]: https://github.com/toml-lang/toml
21[YAML]: https://github.com/chyh1990/yaml-rust
22[INI]: https://github.com/zonyitoo/rust-ini
23[RON]: https://github.com/ron-rs/ron
24[JSON5]: https://github.com/callum-oakley/json5-rs
25
26Please note that this library can not be used to write changed configuration
27values back to the configuration file(s)!
28
29## Usage
30
31```toml
32[dependencies]
33config = "0.13.1"
34```
35
36### Feature flags
37
38 - `ini` - Adds support for reading INI files
39 - `json` - Adds support for reading JSON files
40 - `yaml` - Adds support for reading YAML files
41 - `toml` - Adds support for reading TOML files
42 - `ron` - Adds support for reading RON files
43 - `json5` - Adds support for reading JSON5 files
44
45### Support for custom formats
46
47Library 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.
48
49See [custom_format](https://github.com/mehcode/config-rs/tree/master/examples/custom_format) example for more information.
50
51### More
52
53See the [documentation](https://docs.rs/config) or [examples](https://github.com/mehcode/config-rs/tree/master/examples) for
54more usage information.
55
56
57## MSRV
58
59We currently support Rust 1.56.0 and newer.
60
61
62## License
63
64config-rs is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).
65
66See LICENSE-APACHE and LICENSE-MIT for details.
67