1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-31 09:24:31 +03:00

Load multiple config files specified in the MAS_CONFIG env variable

This commit is contained in:
Quentin Gliech
2022-03-14 17:46:18 +01:00
parent 8e9bda654f
commit 785101564a

View File

@ -72,7 +72,14 @@ impl Options {
pub fn load_config<'de, T: ConfigurationSection<'de>>(&self) -> anyhow::Result<T> {
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()
};