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
//! Finding the RustyRoad config file the shared pool reads.
//!
//! A server binary is not always started from the project root: a Kubernetes job runs it
//! from `/`, and `cargo run` from a subfolder. So the search walks up from both the working
//! directory and the executable, and checks the secrets mount a deployment injects.
use env;
use PathBuf;
/// Where an injected secrets volume places the config.
const SECRETS_MOUNT: &str = "/vault/secrets/rustyroad.toml";
/// Returns the first config file that exists, if any.
pub
/// Every path checked, in priority order and without duplicates.
///
/// `RUSTYROAD_CONFIG_PATH` first, then the secrets mount, then each searched directory's
/// file for the active environment followed by the shared names.
pub