From 54401d2a21b83a25f2f28cca90220c153cad0f11 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Tue, 27 Feb 2024 13:18:01 +0100 Subject: [PATCH] app: apply review --- crates/app/src/config.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/app/src/config.rs b/crates/app/src/config.rs index 552a951..17cd39c 100644 --- a/crates/app/src/config.rs +++ b/crates/app/src/config.rs @@ -14,11 +14,16 @@ pub struct Config { impl Config { /// Get the configs from all possible places (args, file, env...) pub fn read(args: &CliConfigs) -> Self { - let config = if let Some(config) = &args.config_path { - Ok(config.clone()) - } else { - find_config_file() - }; + // let config = if let Some(config) = &args.config_path { + // Ok(config.clone()) + // } else { + // find_config_file() + // }; + let config = args + .config_path + .clone() + .ok_or(()) + .or_else(|()| find_config_file()); // try to read a maybe existing config file let config = config.ok().and_then(|path| {