Documentation: - Add detailed README files for all services (auth, character, database, launcher, packet, utils, world) - Create API documentation for the database service with detailed endpoint specifications - Document database schema and relationships - Add service architecture overviews and configuration instructions Unit Tests: - Implement comprehensive test suite for database repositories (user, character, session) - Add gRPC service tests for database interactions - Create tests for packet service components (bufferpool, connection, packets) - Add utility service tests (health check, logging, load balancer, redis cache, service discovery) - Implement auth service user tests - Add character service tests Code Structure: - Reorganize test files into a more consistent structure - Create a dedicated tests crate for integration testing - Add test helpers and mock implementations for easier testing
19 lines
683 B
Rust
19 lines
683 B
Rust
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(())
|
|
}
|