From 785101564a7cafc26b2a0cf55071dfefd22e3dfa Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Mon, 14 Mar 2022 17:46:18 +0100 Subject: [PATCH] Load multiple config files specified in the MAS_CONFIG env variable --- crates/cli/src/commands/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/cli/src/commands/mod.rs b/crates/cli/src/commands/mod.rs index 3840cfb3..6297ff41 100644 --- a/crates/cli/src/commands/mod.rs +++ b/crates/cli/src/commands/mod.rs @@ -72,7 +72,14 @@ impl Options { pub fn load_config<'de, T: ConfigurationSection<'de>>(&self) -> anyhow::Result { let configs = if self.config.is_empty() { - vec![std::env::var("MAS_CONFIG").map_or_else(|_| "config.yaml".into(), PathBuf::from)] + // Read the MAS_CONFIG environment variable + std::env::var("MAS_CONFIG") + // Default to "config.yaml" + .unwrap_or_else(|_| "config.yaml".to_string()) + // Split the file list on `:` + .split(':') + .map(PathBuf::from) + .collect() } else { self.config.clone() };