- 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
22 lines
881 B
Rust
22 lines
881 B
Rust
use dotenv::dotenv;
|
|
use std::env;
|
|
use utils::{health_check, logging};
|
|
use utils::service_discovery::{get_kube_service_endpoints_by_dns, get_service_endpoints_by_dns};
|
|
|
|
#[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(())
|
|
}
|