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";