This commit is contained in:
2022-01-31 00:47:18 +08:00
parent 82e6761c8d
commit d685636417
3 changed files with 11 additions and 9 deletions

2
Cargo.lock generated
View File

@@ -4,7 +4,7 @@ version = 3
[[package]]
name = "acme-client"
version = "1.0.2"
version = "1.0.3"
dependencies = [
"acme-lib",
"async-std",

View File

@@ -1,6 +1,6 @@
[package]
name = "acme-client"
version = "1.0.2"
version = "1.0.3"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
description = "Acme auto challenge client, acme-client can issue certificates from Let's encrypt"

View File

@@ -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(", ")));
}
}