upend/cli/src/common.rs

31 lines
860 B
Rust
Raw Normal View History

2024-01-26 22:41:43 +01:00
use constcat::concat;
2023-08-24 19:55:35 +02:00
2023-05-24 11:20:13 +02:00
use lazy_static::lazy_static;
2024-01-26 22:41:43 +01:00
use shadow_rs::shadow;
2023-06-25 15:29:52 +02:00
shadow!(build);
2024-01-26 22:41:43 +01:00
#[cfg(not(debug_assertions))]
pub const RESOURCE_PATH: &str = "../share/upend";
2024-01-26 22:41:43 +01:00
#[cfg(debug_assertions)]
pub const RESOURCE_PATH: &str = "./tmp/resources";
pub const WEBUI_PATH: &str = concat!(RESOURCE_PATH, "/webui");
2023-05-24 11:20:13 +02:00
lazy_static! {
2023-06-25 15:29:52 +02:00
static ref APP_USER_AGENT: String = format!("upend / {}", build::PKG_VERSION);
2023-05-24 11:20:13 +02:00
pub static ref REQWEST_CLIENT: reqwest::blocking::Client = reqwest::blocking::Client::builder()
.user_agent(APP_USER_AGENT.as_str())
.build()
.unwrap();
pub static ref REQWEST_ASYNC_CLIENT: reqwest::Client = reqwest::Client::builder()
.user_agent(APP_USER_AGENT.as_str())
.build()
.unwrap();
2023-05-24 11:20:13 +02:00
}
2023-10-22 21:18:00 +02:00
pub fn get_version() -> &'static str {
option_env!("UPEND_VERSION").unwrap_or("unknown")
}