Always return 200 OK on /v0/health, reinstate admin api doc as draft and complete it

This commit is contained in:
Alex Auvolat
2022-12-11 18:11:12 +01:00
parent d7868c48a4
commit 5ea5fd2130
2 changed files with 687 additions and 6 deletions
+1 -6
View File
@@ -47,15 +47,10 @@ pub async fn handle_get_cluster_status(garage: &Arc<Garage>) -> Result<Response<
pub async fn handle_get_cluster_health(garage: &Arc<Garage>) -> Result<Response<Body>, Error> {
let health = garage.system.health();
let status = match health.status {
ClusterHealthStatus::Unavailable => StatusCode::SERVICE_UNAVAILABLE,
_ => StatusCode::OK,
};
let resp_json =
serde_json::to_string_pretty(&health).map_err(garage_util::error::Error::from)?;
Ok(Response::builder()
.status(status)
.status(StatusCode::OK)
.header(http::header::CONTENT_TYPE, "application/json")
.body(Body::from(resp_json))?)
}