Skip to content

Commit

Permalink
fix: changed cfg(debug_assertions) to is_testing for runtime checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare authored and johan-bjareholt committed Mar 25, 2020
1 parent 5b52961 commit 96bbb0e
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions aw-server/src/endpoints/mod.rs
Expand Up @@ -9,6 +9,7 @@ use rocket::State;
use rocket_contrib::json::JsonValue;
use uuid::Uuid;

use crate::config::is_testing;
use crate::config::AWConfig;
use crate::dirs;

Expand Down Expand Up @@ -88,24 +89,13 @@ fn get_device_id() -> String {

#[get("/")]
fn server_info() -> JsonValue {
let testing: bool;
#[cfg(debug_assertions)]
{
testing = true;
}
//TODO: Should this be commented?
#[cfg(not(debug_assertions))]
{
testing = false;
}

let hostname = gethostname().into_string().unwrap_or("unknown".to_string());
const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");

json!({
"hostname": hostname,
"version": format!("aw-server-rust v{}", VERSION.unwrap_or("(unknown)")),
"testing": testing,
"version": format!("v{} (rust)", VERSION.unwrap_or("(unknown)")),
"testing": is_testing(),
"device_id": get_device_id(),
})
}
Expand Down

0 comments on commit 96bbb0e

Please sign in to comment.