- 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:
@@ -9,12 +9,11 @@ use std::env;
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use tokio::{select, signal};
|
||||
use tokio::{select, signal};
|
||||
use tonic::transport::Server;
|
||||
use tracing::{info, Level};
|
||||
use warp::Filter;
|
||||
|
||||
mod consul_registration;
|
||||
use utils::consul_registration;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -25,6 +24,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
let addr = env::var("DATABASE_SERVICE_ADDR").unwrap_or_else(|_| "127.0.0.1".to_string());
|
||||
let port = env::var("DATABASE_SERVICE_PORT").unwrap_or_else(|_| "50052".to_string());
|
||||
let health_port = env::var("HEALTH_CHECK_PORT").unwrap_or_else(|_| "8080".to_string());
|
||||
|
||||
let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||||
let redis_url = std::env::var("REDIS_URL").unwrap_or_else(|_| "redis://127.0.0.1:6379".to_string());
|
||||
|
||||
@@ -32,8 +33,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let service_name = env::var("SERVICE_NAME").unwrap_or_else(|_| "database-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!("{}:8080", service_address);
|
||||
let health_check_url = format!("http://{}:{}/health", service_address, health_port);
|
||||
let health_check_endpoint_addr = format!("{}:{}", service_address, health_port);
|
||||
|
||||
// Register service with Consul
|
||||
consul_registration::register_service(
|
||||
|
||||
Reference in New Issue
Block a user