diff options
author | rustdesk <[email protected]> | 2023-02-01 23:31:00 +0800 |
---|---|---|
committer | rustdesk <[email protected]> | 2023-02-01 23:31:00 +0800 |
commit | d88e4b5151f86a6c5ae0884520841495d46fbe3e (patch) | |
tree | 41081b186282cefeff1ddfa3277071f63737655f /src | |
parent | fe3b42809ab1f50ee0529c997c0d5ad122b0e6f2 (diff) | |
download | rustdesk-server-d88e4b5151f86a6c5ae0884520841495d46fbe3e.tar.gz rustdesk-server-d88e4b5151f86a6c5ae0884520841495d46fbe3e.zip |
make hbbr / hbbs share the PORT value of .env
Diffstat (limited to 'src')
-rw-r--r-- | src/hbbr.rs | 13 | ||||
-rw-r--r-- | src/version.rs | 3 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/hbbr.rs b/src/hbbr.rs index 00a4f83..d7f7932 100644 --- a/src/hbbr.rs +++ b/src/hbbr.rs @@ -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(()) } diff --git a/src/version.rs b/src/version.rs deleted file mode 100644 index 6cf4a19..0000000 --- a/src/version.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub const VERSION: &str = "1.1.7"; -#[allow(dead_code)] -pub const BUILD_DATE: &str = "2023-02-01 10:45"; |