make hbbr / hbbs share the PORT value of .env

This commit is contained in:
rustdesk 2023-02-01 23:31:00 +08:00
parent fe3b42809a
commit d88e4b5151
2 changed files with 11 additions and 5 deletions

View File

@ -29,9 +29,18 @@ fn main() -> ResultType<()> {
section.iter().for_each(|(k, v)| std::env::set_var(k, v));
}
}
let mut port = RELAY_PORT;
if let Ok(v) = std::env::var("PORT") {
let v: i32 = v.parse().unwrap_or_default();
if v > 0 {
port = v + 1;
}
}
start(
matches.value_of("port").unwrap_or(&RELAY_PORT.to_string()),
matches.value_of("key").unwrap_or(""),
matches.value_of("port").unwrap_or(&port.to_string()),
matches
.value_of("key")
.unwrap_or(&std::env::var("KEY").unwrap_or_default()),
)?;
Ok(())
}

View File

@ -1,3 +0,0 @@
pub const VERSION: &str = "1.1.7";
#[allow(dead_code)]
pub const BUILD_DATE: &str = "2023-02-01 10:45";