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
28 lines
945 B
Rust
28 lines
945 B
Rust
use dotenv::dotenv;
|
|
use std::env;
|
|
use utils::service_discovery::{get_kube_service_endpoints_by_dns, get_service_endpoints_by_dns};
|
|
use utils::{health_check, logging};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
dotenv().ok();
|
|
let app_name = env!("CARGO_PKG_NAME");
|
|
logging::setup_logging(app_name, &["world_service", "health_check"]);
|
|
|
|
// Set the gRPC server address
|
|
let addr = env::var("LISTEN_ADDR").unwrap_or_else(|_| "0.0.0.0".to_string());
|
|
let port = env::var("SERVICE_PORT").unwrap_or_else(|_| "50054".to_string());
|
|
let db_url = format!(
|
|
"http://{}",
|
|
get_kube_service_endpoints_by_dns("database-service", "tcp", "database-service")
|
|
.await?
|
|
.get(0)
|
|
.unwrap()
|
|
);
|
|
|
|
// Register service with Consul
|
|
health_check::start_health_check(addr.as_str()).await?;
|
|
utils::signal_handler::wait_for_signal().await;
|
|
Ok(())
|
|
}
|