From 80d0b05dd726d65dd4f73aabee6f048af980bf2b Mon Sep 17 00:00:00 2001 From: shenjack-5600u <3695888@qq.com> Date: Sat, 27 Jan 2024 22:35:14 +0800 Subject: [PATCH] rua! --- src/cluster.rs | 3 +-- src/config.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cluster.rs b/src/cluster.rs index 1fdfb42..a660100 100644 --- a/src/cluster.rs +++ b/src/cluster.rs @@ -107,13 +107,12 @@ mod tests { } fn gen_config() -> Config { - let center_url = "openbmclapi.bangbang93.com".to_string(); // 读取 config.toml 获得 let raw_config = std::fs::read_to_string("config.toml").unwrap(); let test_conf: TestConfig = toml::from_str(raw_config.as_str()).unwrap(); Config::new( - center_url, + None, "".to_string(), test_conf.cluster_port, test_conf.cluster_id, diff --git a/src/config.rs b/src/config.rs index df0941b..7a21d02 100644 --- a/src/config.rs +++ b/src/config.rs @@ -27,7 +27,7 @@ pub struct Config { impl Config { pub fn new( - center_url: String, + center_url: Option, host_ip: String, host_port: u32, cluster_id: String, @@ -36,7 +36,7 @@ impl Config { ) -> Self { // https://openbmclapi.bangbang93.com Self { - center_url, + center_url: center_url.unwrap_or("https://openbmclapi.bangbang93.com".to_string()), host_ip, host_port, cluster_id,