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/main.rs | |
parent | 61e6df6209b3c55e4c07c6baf2fabfba23a474f1 (diff) | |
download | tricot-5535c4951a832d65755afa53822a36e96681320f.tar.gz tricot-5535c4951a832d65755afa53822a36e96681320f.zip |
Retrieve let's encrypt certificates
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 3289c46..d7f1e24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,21 +1,33 @@ #[macro_use] extern crate anyhow; +mod cert; +mod cert_store; mod consul; +mod http; mod proxy_config; -mod acme; use log::*; -#[tokio::main] +#[tokio::main(flavor = "multi_thread")] async fn main() { + if std::env::var("RUST_LOG").is_err() { + std::env::set_var("RUST_LOG", "tricot=debug") + } pretty_env_logger::init(); info!("Starting Tricot"); let consul = consul::Consul::new("http://10.42.0.21:8500", "tricot/"); let mut rx_proxy_config = proxy_config::spawn_proxy_config_task(consul.clone(), "carcajou"); - tokio::spawn(acme::acme_task(consul.clone(), rx_proxy_config.clone())); + let cert_store = cert_store::CertStore::new(consul.clone()); + tokio::spawn( + cert_store + .clone() + .watch_proxy_config(rx_proxy_config.clone()), + ); + + tokio::spawn(http::serve_http(consul.clone())); while rx_proxy_config.changed().await.is_ok() { info!("Proxy config: {:#?}", *rx_proxy_config.borrow()); |