From fa9903ace1f1ed193bdb9209ba38ee15cc56c35c Mon Sep 17 00:00:00 2001 From: lbl8603 <49143209+lbl8603@users.noreply.github.com> Date: Tue, 30 Jul 2024 22:54:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=B2=A1=E6=9C=89=E8=AF=BB=E5=8F=96=E5=8A=A0=E5=AF=86?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/src/config/file_config.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 }