aboutsummaryrefslogtreecommitdiff
path: root/src/acme.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/acme.rs')
-rw-r--r--src/acme.rs41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/acme.rs b/src/acme.rs
deleted file mode 100644
index c6dbc5b..0000000
--- a/src/acme.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use std::collections::HashSet;
-
-use log::*;
-use anyhow::Result;
-use tokio::{sync::watch, time::sleep};
-
-use acme_micro::{Error, Certificate, Directory, DirectoryUrl};
-use acme_micro::create_p384_key;
-
-use crate::consul::Consul;
-use crate::proxy_config::ProxyConfig;
-
-pub async fn acme_task(mut consul: Consul, mut rx_proxy_config: watch::Receiver<ProxyConfig>) {
- while rx_proxy_config.changed().await.is_ok() {
- let mut domains: HashSet<String> = HashSet::new();
-
- for ent in rx_proxy_config.borrow().entries.iter() {
- domains.insert(ent.host.clone());
- }
- info!("Ensuring we have certs for domains: {:#?}", domains);
-
- let results = futures::future::join_all(
- domains.iter()
- .map(|dom| renew_cert(dom, &consul))
- ).await;
-
- for (res, dom) in results.iter().zip(domains.iter()) {
- if let Err(e) = res {
- error!("{}: {}", dom, e);
- }
- }
- }
-}
-
-async fn renew_cert(dom: &str, consul: &Consul) -> Result<()> {
- let dir = Directory::from_url(DirectoryUrl::LetsEncrypt)?;
- let contact = vec!["mailto:alex@adnab.me".to_string()];
- let acc = dir.register_account(contact.clone())?;
- // TODO
- unimplemented!()
-}