rename mode to consul_http_api

This commit is contained in:
Roberto Hidalgo
2023-05-10 20:11:14 -06:00
parent 011f473048
commit 6b69404f1a
3 changed files with 43 additions and 51 deletions
+8 -8
View File
@@ -136,22 +136,22 @@ pub struct AdminConfig {
}
#[derive(Deserialize, Debug, Clone)]
pub enum ConsulDiscoveryMode {
pub enum ConsulDiscoveryAPI {
#[serde(rename_all = "lowercase")]
Node,
Service,
Catalog,
Agent,
}
impl ConsulDiscoveryMode {
impl ConsulDiscoveryAPI {
fn default() -> Self {
ConsulDiscoveryMode::Node
ConsulDiscoveryAPI::Catalog
}
}
#[derive(Deserialize, Debug, Clone)]
pub struct ConsulDiscoveryConfig {
/// Mode of consul operation: either `node` (the default) or `service`
#[serde(default = "ConsulDiscoveryMode::default")]
pub mode: ConsulDiscoveryMode,
/// The consul api to use when registering: either `catalog` (the default) or `agent`
#[serde(default = "ConsulDiscoveryAPI::default")]
pub consul_http_api: ConsulDiscoveryAPI,
/// Consul http or https address to connect to to discover more peers
pub consul_http_addr: String,
/// Consul service name to use