This commit is contained in:
shenjack-5600u 2024-01-27 22:35:14 +08:00
parent f2efb6b2ff
commit 80d0b05dd7
Signed by: shenjack
GPG Key ID: FDF9864E11C7E79F
2 changed files with 3 additions and 4 deletions

View File

@ -107,13 +107,12 @@ mod tests {
} }
fn gen_config() -> Config { fn gen_config() -> Config {
let center_url = "openbmclapi.bangbang93.com".to_string();
// 读取 config.toml 获得 // 读取 config.toml 获得
let raw_config = std::fs::read_to_string("config.toml").unwrap(); let raw_config = std::fs::read_to_string("config.toml").unwrap();
let test_conf: TestConfig = toml::from_str(raw_config.as_str()).unwrap(); let test_conf: TestConfig = toml::from_str(raw_config.as_str()).unwrap();
Config::new( Config::new(
center_url, None,
"".to_string(), "".to_string(),
test_conf.cluster_port, test_conf.cluster_port,
test_conf.cluster_id, test_conf.cluster_id,

View File

@ -27,7 +27,7 @@ pub struct Config {
impl Config { impl Config {
pub fn new( pub fn new(
center_url: String, center_url: Option<String>,
host_ip: String, host_ip: String,
host_port: u32, host_port: u32,
cluster_id: String, cluster_id: String,
@ -36,7 +36,7 @@ impl Config {
) -> Self { ) -> Self {
// https://openbmclapi.bangbang93.com // https://openbmclapi.bangbang93.com
Self { Self {
center_url, center_url: center_url.unwrap_or("https://openbmclapi.bangbang93.com".to_string()),
host_ip, host_ip,
host_port, host_port,
cluster_id, cluster_id,