aboutsummaryrefslogtreecommitdiff
path: root/src/consul_actor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/consul_actor.rs')
-rw-r--r--src/consul_actor.rs14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/consul_actor.rs b/src/consul_actor.rs
index 136b248..1b80730 100644
--- a/src/consul_actor.rs
+++ b/src/consul_actor.rs
@@ -18,7 +18,7 @@ use crate::messages;
pub enum DiplonatParameter {
TcpPort(HashSet<u16>),
UdpPort(HashSet<u16>),
- Acme(HashSet<String>),
+ Acme(Vec<String>),
}
#[derive(Serialize, Deserialize, Debug)]
@@ -62,10 +62,6 @@ fn to_parameters(catalog: &consul::CatalogNode) -> Vec<DiplonatConsul> {
}
fn to_open_ports(params: &Vec<DiplonatConsul>) -> messages::PublicExposedPorts {
- // let mut op = messages::PublicExposedPorts {
- // tcp_ports: HashSet::new(),
- // udp_ports: HashSet::new()
- // };
let mut op = messages::PublicExposedPorts::new();
for conf in params {
@@ -74,7 +70,7 @@ fn to_open_ports(params: &Vec<DiplonatConsul>) -> messages::PublicExposedPorts {
match parameter {
DiplonatParameter::TcpPort(p) => op.tcp_ports.extend(p),
DiplonatParameter::UdpPort(p) => op.udp_ports.extend(p),
- DiplonatParameter::Acme(urls) => op.acme.extend(urls.clone()),
+ DiplonatParameter::Acme(urls) => op.acme.extend_from_slice(urls.as_slice()),
};
}
}
@@ -85,10 +81,6 @@ fn to_open_ports(params: &Vec<DiplonatConsul>) -> messages::PublicExposedPorts {
impl ConsulActor {
pub fn new(config: RuntimeConfigConsul) -> Self {
let (tx, rx) = watch::channel(messages::PublicExposedPorts::new());
- // let (tx, rx) = watch::channel(messages::PublicExposedPorts{
- // tcp_ports: HashSet::new(),
- // udp_ports: HashSet::new()
- // });
return Self {
consul: consul::Consul::new(&config.url),
@@ -118,7 +110,7 @@ impl ConsulActor {
};
self.retries = 0;
let msg = to_open_ports(&to_parameters(&catalog));
- debug!("Extracted configuration: {:#?}", msg);
+ debug!("Extracted configuration:\n{:#?}", msg);
self.tx_open_ports.broadcast(msg)?;
}