|
@ -5,7 +5,7 @@ use acme_common::crypto::{HashFunction, KeyType}; |
|
|
use acme_common::error::Error;
|
|
|
use acme_common::error::Error;
|
|
|
use glob::glob;
|
|
|
use glob::glob;
|
|
|
use log::info;
|
|
|
use log::info;
|
|
|
use serde::Deserialize;
|
|
|
|
|
|
|
|
|
use serde::{de, Deserialize, Deserializer};
|
|
|
use std::collections::HashMap;
|
|
|
use std::collections::HashMap;
|
|
|
use std::fmt;
|
|
|
use std::fmt;
|
|
|
use std::fs::{self, File};
|
|
|
use std::fs::{self, File};
|
|
@ -421,6 +421,7 @@ impl Certificate { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize)]
|
|
|
#[derive(Clone, Debug, Deserialize)]
|
|
|
|
|
|
#[serde(remote = "Self")]
|
|
|
#[serde(deny_unknown_fields)]
|
|
|
#[serde(deny_unknown_fields)]
|
|
|
pub struct Identifier {
|
|
|
pub struct Identifier {
|
|
|
pub challenge: String,
|
|
|
pub challenge: String,
|
|
@ -430,6 +431,26 @@ pub struct Identifier { |
|
|
pub env: HashMap<String, String>,
|
|
|
pub env: HashMap<String, String>,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl<'de> Deserialize<'de> for Identifier {
|
|
|
|
|
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
|
|
|
|
where
|
|
|
|
|
|
D: Deserializer<'de>,
|
|
|
|
|
|
{
|
|
|
|
|
|
let unchecked = Identifier::deserialize(deserializer)?;
|
|
|
|
|
|
let filled_nb: u8 = [unchecked.dns.is_some(), unchecked.ip.is_some()]
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
.copied()
|
|
|
|
|
|
.map(u8::from)
|
|
|
|
|
|
.sum();
|
|
|
|
|
|
if filled_nb != 1 {
|
|
|
|
|
|
return Err(de::Error::custom(
|
|
|
|
|
|
"one and only one of `dns` or `ip` must be specified",
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
Ok(unchecked)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
impl fmt::Display for Identifier {
|
|
|
impl fmt::Display for Identifier {
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
let s = String::new();
|
|
|
let s = String::new();
|
|
|