- 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:
@@ -1,3 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use reqwest::Client;
|
||||
use serde::Serialize;
|
||||
use uuid::Uuid;
|
||||
@@ -8,6 +9,8 @@ struct ConsulRegistration {
|
||||
name: String,
|
||||
address: String,
|
||||
port: u16,
|
||||
tags: Vec<String>,
|
||||
meta: HashMap<String, String>,
|
||||
check: ConsulCheck,
|
||||
}
|
||||
|
||||
@@ -28,6 +31,8 @@ pub async fn register_service(
|
||||
service_name: &str,
|
||||
service_address: &str,
|
||||
service_port: u16,
|
||||
tags: Vec<String>,
|
||||
meta: HashMap<String, String>,
|
||||
health_check_url: &str,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let registration = ConsulRegistration {
|
||||
@@ -35,6 +40,8 @@ pub async fn register_service(
|
||||
name: service_name.to_string(),
|
||||
address: service_address.to_string(),
|
||||
port: service_port,
|
||||
tags,
|
||||
meta,
|
||||
check: ConsulCheck {
|
||||
http: health_check_url.to_string(),
|
||||
interval: "10s".to_string(), // Health check interval
|
||||
|
||||
Reference in New Issue
Block a user