aboutsummaryrefslogtreecommitdiff
path: root/src/proxy_config.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-12-07 13:50:44 +0100
committerAlex Auvolat <alex@adnab.me>2021-12-07 13:50:44 +0100
commit5535c4951a832d65755afa53822a36e96681320f (patch)
treef5b46340c16dbf97f69711f519824512b8d0db80 /src/proxy_config.rs
parent61e6df6209b3c55e4c07c6baf2fabfba23a474f1 (diff)
downloadtricot-5535c4951a832d65755afa53822a36e96681320f.tar.gz
tricot-5535c4951a832d65755afa53822a36e96681320f.zip
Retrieve let's encrypt certificates
Diffstat (limited to 'src/proxy_config.rs')
-rw-r--r--src/proxy_config.rs12
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");
}
});