- removed: api-service
- removed: session-service - updated: moved health check out of consul registration - updated: get service info to pull the service from the default namespace for the service account - updated: the rest of the services to be able to handle the new database tables
This commit is contained in:
25
utils/src/health_check.rs
Normal file
25
utils/src/health_check.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use std::env;
|
||||
use std::net::ToSocketAddrs;
|
||||
use warp::Filter;
|
||||
|
||||
pub async fn start_health_check(service_address: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let health_port = env::var("HEALTH_CHECK_PORT").unwrap_or_else(|_| "8082".to_string());
|
||||
let health_check_endpoint_addr = format!("{}:{}", service_address, health_port);
|
||||
|
||||
// Start health-check endpoint
|
||||
let log = warp::log("health_check");
|
||||
let health_route = warp::path!("health")
|
||||
.map(|| warp::reply::with_status("OK", warp::http::StatusCode::OK))
|
||||
.with(log);
|
||||
|
||||
tokio::spawn(
|
||||
warp::serve(health_route).run(
|
||||
health_check_endpoint_addr
|
||||
.to_socket_addrs()?
|
||||
.next()
|
||||
.unwrap(),
|
||||
),
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user