Skip to content

Commit 96bbb0e

Browse files
ErikBjarejohan-bjareholt
authored andcommitted
fix: changed cfg(debug_assertions) to is_testing for runtime checks
1 parent 5b52961 commit 96bbb0e

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

aw-server/src/endpoints/mod.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rocket::State;
99
use rocket_contrib::json::JsonValue;
1010
use uuid::Uuid;
1111

12+
use crate::config::is_testing;
1213
use crate::config::AWConfig;
1314
use crate::dirs;
1415

@@ -88,24 +89,13 @@ fn get_device_id() -> String {
8889

8990
#[get("/")]
9091
fn server_info() -> JsonValue {
91-
let testing: bool;
92-
#[cfg(debug_assertions)]
93-
{
94-
testing = true;
95-
}
96-
//TODO: Should this be commented?
97-
#[cfg(not(debug_assertions))]
98-
{
99-
testing = false;
100-
}
101-
10292
let hostname = gethostname().into_string().unwrap_or("unknown".to_string());
10393
const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
10494

10595
json!({
10696
"hostname": hostname,
107-
"version": format!("aw-server-rust v{}", VERSION.unwrap_or("(unknown)")),
108-
"testing": testing,
97+
"version": format!("v{} (rust)", VERSION.unwrap_or("(unknown)")),
98+
"testing": is_testing(),
10999
"device_id": get_device_id(),
110100
})
111101
}

0 commit comments

Comments
 (0)