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
66
67
68
69
70
71
72
73
74
//! Layered TOML configuration (slice 8.3).
//!
//! `Settings::load("local")` reads, in order:
//!
//! 1. `config/default.toml` — committed defaults shared by every env.
//! 2. `config/{env}.toml` — env-specific overrides (`local`, `staging`,
//! `prod`, …). Missing file is fine — the load skips it.
//! 3. Environment variables — anything matching `RUSTANGO__SECTION__KEY`
//! overrides the corresponding nested TOML key. Double-underscore
//! is the path separator. `RUSTANGO__DATABASE__URL=postgres://…`
//! overrides `[database] url = "…"`.
//!
//! The pipeline returns a typed [`Settings`] struct with sections
//! for `database`, `secret_key`, `admin`, `tenancy`, `cache`, `jobs`,
//! `mail`. Unknown keys in the TOML are ignored (forward-compat).
//!
//! # Example
//!
//! ```ignore
//! // config/default.toml
//! // [database]
//! // url = "postgres://localhost/myapp_dev"
//! //
//! // [admin]
//! // read_only_tables = ["audit_log"]
//!
//! // config/prod.toml
//! // [database]
//! // pool_max_size = 50
//!
//! // RUSTANGO__DATABASE__URL=postgres://…/myapp_prod cargo run
//!
//! let cfg = rustango::config::Settings::load("prod")?;
//! assert_eq!(cfg.database.pool_max_size, 50);
//! ```
//!
//! Gated by the `config` feature (in `default`). Drop with
//! `default-features = false` if you want a bare ORM dep without
//! `toml` pulled in.
pub use ConfigError;
pub use ;