Create health check bin
This commit is contained in:
21
src/health.rs
Normal file
21
src/health.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use libretunes::api::health::health;
|
||||
|
||||
use server_fn::client::set_server_url;
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn main() {
|
||||
let host = std::env::args()
|
||||
.nth(1)
|
||||
.unwrap_or("http://localhost:3000".to_string());
|
||||
|
||||
println!("Runing health check against {host}");
|
||||
|
||||
set_server_url(Box::leak(host.into_boxed_str()));
|
||||
match health().await {
|
||||
Ok(result) => println!("Health check result: {result:?}"),
|
||||
Err(err) => {
|
||||
println!("Error: {err}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user