app: apply review

This commit is contained in:
Schrottkatze 2024-02-27 13:18:01 +01:00
parent ecc466d01d
commit 6d318aa7c9
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc

View file

@ -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| {