objectstore_server/
healthcheck.rs

1use anyhow::Result;
2
3use crate::config::Config;
4
5pub async fn healthcheck(config: Config) -> Result<()> {
6    let client = reqwest::Client::new();
7    let url = format!("http://{}/health", config.http_addr);
8
9    tracing::debug!("sending healthcheck request to {}", url);
10    let response = client.get(&url).send().await?;
11    if !response.status().is_success() {
12        anyhow::bail!("Bad Status: {}", response.status());
13    }
14
15    tracing::info!("OK");
16    Ok(())
17}