summaryrefslogtreecommitdiffstats
path: root/src/api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api.rs')
-rw-r--r--src/api.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/api.rs b/src/api.rs
index 8dfd2ca..1489c21 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -3,11 +3,11 @@ use std::collections::HashMap;
use axum::{extract::State, response::IntoResponse, Json};
use serde::{Deserialize, Serialize};
-use crate::{service::Services, Status};
+use crate::{service::ServiceHandles, Status};
pub mod services;
-pub fn router() -> axum::Router<Services> {
+pub fn router() -> axum::Router<ServiceHandles> {
use axum::routing::get;
axum::Router::new()
@@ -37,11 +37,11 @@ impl IntoResponse for Health {
}
}
-pub async fn healthcheck(State(services): State<Services>) -> Health {
- let checks = match services.check().await {
- Ok(c) => c,
- Err(err) => return err.into(),
- };
+pub async fn healthcheck(State(services): State<ServiceHandles>) -> Health {
+ let checks = services
+ .iter()
+ .map(|(name, srv)| (name.clone(), srv.status()))
+ .collect::<HashMap<String, Status>>();
let status = match checks
.values()