diff --git a/common/src/config/file_config.rs b/common/src/config/file_config.rs index c5b2b1b..8973daa 100644 --- a/common/src/config/file_config.rs +++ b/common/src/config/file_config.rs @@ -126,12 +126,12 @@ pub fn read_config(file_path: &str) -> anyhow::Result<(Config, Vec, bool None => None, Some(r) => Some(r.map_err(|e| anyhow!("ip {:?} error:{}", &file_conf.ip, e))?), }; - let cipher_model = { + let cipher_model = if let Some(v) = file_conf.cipher_model { + CipherModel::from_str(&v).map_err(|e| anyhow!("{}", e))? + } else { #[cfg(not(any(feature = "aes_gcm", feature = "server_encrypt")))] - if file_conf.password.is_some() && file_conf.cipher_model.is_none() { + if file_conf.password.is_some() { Err(anyhow!("cipher_model undefined"))? - } else if let Some(v) = file_conf.cipher_model { - CipherModel::from_str(&v).map_err(|e| anyhow!("{}", e))? } else { CipherModel::None }