diff options
author | Alex Auvolat <alex@adnab.me> | 2021-12-07 13:50:44 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-12-07 13:50:44 +0100 |
commit | 5535c4951a832d65755afa53822a36e96681320f (patch) | |
tree | f5b46340c16dbf97f69711f519824512b8d0db80 /src/proxy_config.rs | |
parent | 61e6df6209b3c55e4c07c6baf2fabfba23a474f1 (diff) | |
download | tricot-5535c4951a832d65755afa53822a36e96681320f.tar.gz tricot-5535c4951a832d65755afa53822a36e96681320f.zip |
Retrieve let's encrypt certificates
Diffstat (limited to 'src/proxy_config.rs')
-rw-r--r-- | src/proxy_config.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/proxy_config.rs b/src/proxy_config.rs index e118a33..891fdef 100644 --- a/src/proxy_config.rs +++ b/src/proxy_config.rs @@ -1,4 +1,5 @@ use std::net::SocketAddr; +use std::sync::Arc; use std::{cmp, time::Duration}; use log::*; @@ -74,10 +75,13 @@ fn parse_consul_catalog(catalog: &ConsulNodeCatalog) -> ProxyConfig { ProxyConfig { entries } } -pub fn spawn_proxy_config_task(mut consul: Consul, node: &str) -> watch::Receiver<ProxyConfig> { - let (tx, rx) = watch::channel(ProxyConfig { +pub fn spawn_proxy_config_task( + mut consul: Consul, + node: &str, +) -> watch::Receiver<Arc<ProxyConfig>> { + let (tx, rx) = watch::channel(Arc::new(ProxyConfig { entries: Vec::new(), - }); + })); let node = node.to_string(); @@ -105,7 +109,7 @@ pub fn spawn_proxy_config_task(mut consul: Consul, node: &str) -> watch::Receive let config = parse_consul_catalog(&catalog); debug!("Extracted configuration: {:#?}", config); - tx.send(config).expect("Internal error"); + tx.send(Arc::new(config)).expect("Internal error"); } }); |