Add TLS support for Consul discovery + refactoring #405

Merged
lx merged 5 commits from consul-tls into main 2022-10-18 20:20:55 +00:00
Showing only changes of commit 2da8786f54 - Show all commits

View file

@ -290,6 +290,14 @@ impl System {
let system_endpoint = netapp.endpoint(SYSTEM_RPC_PATH.into()); let system_endpoint = netapp.endpoint(SYSTEM_RPC_PATH.into());
#[cfg(feature = "consul-discovery")]
let consul_discovery = match &config.consul_discovery {
Some(cfg) => Some(
ConsulDiscovery::new(cfg.clone())
.ok_or_message("Invalid Consul discovery configuration")?,
),
None => None,
};
#[cfg(not(feature = "consul-discovery"))] #[cfg(not(feature = "consul-discovery"))]
if config.consul_discovery.is_some() { if config.consul_discovery.is_some() {
warn!("Consul discovery is not enabled in this build."); warn!("Consul discovery is not enabled in this build.");
@ -300,15 +308,6 @@ impl System {
warn!("Kubernetes discovery is not enabled in this build."); warn!("Kubernetes discovery is not enabled in this build.");
} }
#[cfg(feature = "consul-discovery")]
let consul_discovery = match &config.consul_discovery {
Some(cfg) => Some(
ConsulDiscovery::new(cfg.clone())
.ok_or_message("Invalid Consul discovery configuration")?,
),
None => None,
};
let sys = Arc::new(System { let sys = Arc::new(System {
id: netapp.id.into(), id: netapp.id.into(),
persist_cluster_layout, persist_cluster_layout,