From d6856364173b6216dc6444538b049e3736b5ef1d Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Mon, 31 Jan 2022 00:47:18 +0800 Subject: [PATCH] v1.0.3 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee77508..58a85f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "acme-client" -version = "1.0.2" +version = "1.0.3" dependencies = [ "acme-lib", "async-std", diff --git a/Cargo.toml b/Cargo.toml index 52cec65..f078523 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "acme-client" -version = "1.0.2" +version = "1.0.3" authors = ["Hatter Jiang "] edition = "2018" description = "Acme auto challenge client, acme-client can issue certificates from Let's encrypt" diff --git a/src/main.rs b/src/main.rs index 5d540d2..2d27b5a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -285,11 +285,13 @@ async fn main() -> tide::Result<()> { key_file: Some(format!("{}/{}", item.path, KEY_NAME)), outputs_file: None, }; + let mut domains = vec![common_name.clone()]; + dns_names.iter().for_each(|dns_name| domains.push(dns_name.clone())); if let Err(e) = request_acme_certificate(acme_request) { failure!("Request certificate: {}, by acme failed: {}", item.path, e); - acme_statics.add_item(dns_names.clone(), AcmeStatus::Fail(format!("{}", e))); + acme_statics.add_item(domains, AcmeStatus::Fail(format!("{}", e))); } else { - acme_statics.add_item(dns_names.clone(), AcmeStatus::Success); + acme_statics.add_item(domains, AcmeStatus::Success); } } } @@ -332,12 +334,12 @@ async fn main() -> tide::Result<()> { let mut success_domains = vec![]; let mut failed_domains = vec![]; - for acme_static in &acme_statics.items { - if let AcmeStatus::Success = acme_static.status { - success_domains.push(format!("* {}", acme_static.domains.join(", "))); + for acme_item in &acme_statics.items { + if let AcmeStatus::Success = acme_item.status { + success_domains.push(format!("* {}", acme_item.domains.join(", "))); } - if let AcmeStatus::Fail(_) = acme_static.status { - failed_domains.push(format!("* {}", &acme_static.domains.join(", "))); + if let AcmeStatus::Fail(_) = acme_item.status { + failed_domains.push(format!("* {}", acme_item.domains.join(", "))); } }