- add: consul tags and metadata

- update: login reply now requests for the character services from consul to build the server list
This commit is contained in:
2024-12-10 15:45:35 -05:00
parent a7af7f1b9e
commit 9121b7f88b
6 changed files with 93 additions and 16 deletions

View File

@@ -1,3 +1,4 @@
use std::collections::HashMap;
use database::database_service_server::DatabaseServiceServer;
use database_service::database;
use database_service::db::Database;
@@ -38,12 +39,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Register service with Consul
let service_id = consul_registration::generate_service_id();
let tags = vec!["version-1.0".to_string()];
let mut meta = HashMap::new();
consul_registration::register_service(
&consul_url,
service_id.as_str(),
service_name.as_str(),
service_address,
service_port.parse().unwrap_or(50052),
tags,
meta,
&health_check_url,
)
.await?;