1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Layered configuration for Rust.
//!
//! Stack configuration from files, environment variables and Azure App
//! Configuration, merge them by declared precedence, and read the result as
//! typed values.
//!
//! ```rust,no_run
//! # async fn _example() -> Result<(), Box<dyn std::error::Error>> {
//! use stratify::ConfigBuilder;
//!
//! let store = ConfigBuilder::default()
//! .json("config/base.json", 100)
//! .yaml("config/override.yaml", 50)
//! .env("APP_", "__", 10)
//! .build()
//! .await?;
//!
//! let host = store.get_str("database.host");
//! # Ok(()) }
//! ```
//!
//! # Precedence
//!
//! **Lower priority number wins.** A source at priority 10 overrides one at
//! 100. That is the opposite of treating the number as a weight, and it is
//! deliberate: it lets a more specific source be added later without
//! renumbering the ones already there.
//!
//! Merging is deep. Nested objects combine key by key rather than the
//! higher-precedence source replacing a whole subtree.
//!
//! # Feature flags
//!
//! - `azure` — [`AzureAppConfigSource`](source::AzureAppConfigSource), reading
//! from Azure App Configuration. Off by default, because it brings in an HTTP
//! stack that a file-and-environment user should not pay for.
// This crate has no need for `unsafe`, and a configuration library is not where
// anyone should be reaching for it. `forbid` rather than `deny` on purpose:
// `deny` can be switched off by an inner `#[allow]` in the same change that
// introduces the problem.
/// Fluent builder for assembling sources into a [`ConfigStore`].
/// Error type returned by loading and lookup.
/// Built-in configuration sources and the [`Source`] trait.
/// The merged, cached configuration store.
pub use ConfigBuilder;
pub use ConfigError;
pub use Source;
pub use ConfigStore;