- add: utils library
- add: packet-service to handle game client packets - fix: health check for database-service - fix: health check for auth-service
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use crate::service_discovery::get_service_address;
|
||||
use auth_service::auth::auth_service_server::AuthServiceServer;
|
||||
use auth_service::database_client::DatabaseClient;
|
||||
use auth_service::database_client::DatabaseClientTrait;
|
||||
@@ -11,9 +10,8 @@ use tokio::{select, signal};
|
||||
use tonic::transport::Server;
|
||||
use tracing::{info, Level};
|
||||
use warp::Filter;
|
||||
|
||||
mod consul_registration;
|
||||
mod service_discovery;
|
||||
use utils::consul_registration;
|
||||
use utils::service_discovery::get_service_address;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -27,13 +25,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Set the gRPC server address
|
||||
let addr = env::var("AUTH_SERVICE_ADDR").unwrap_or_else(|_| "127.0.0.1".to_string());
|
||||
let port = env::var("AUTH_SERVICE_PORT").unwrap_or_else(|_| "50051".to_string());
|
||||
let health_port = env::var("HEALTH_CHECK_PORT").unwrap_or_else(|_| "8081".to_string());
|
||||
|
||||
let consul_url = env::var("CONSUL_URL").unwrap_or_else(|_| "http://127.0.0.1:8500".to_string());
|
||||
let service_name = env::var("SERVICE_NAME").unwrap_or_else(|_| "auth-service".to_string());
|
||||
let service_address = addr.as_str();
|
||||
let service_port = port.clone();
|
||||
let health_check_url = format!("http://{}:{}/health", service_address, service_port);
|
||||
let health_check_endpoint_addr = format!("{}:8081", service_address);
|
||||
let health_check_url = format!("http://{}:{}/health", service_address, health_port);
|
||||
let health_check_endpoint_addr = format!("{}:{}", service_address, health_port);
|
||||
let db_address = get_service_address(&consul_url, "database-service").await?;
|
||||
|
||||
// Register service with Consul
|
||||
|
||||
Reference in New Issue
Block a user