From b340ac778dfcadba7b6ea719220e2103816d57f7 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sun, 6 Sep 2020 12:15:04 +0200 Subject: [PATCH] Make the account hooks optional --- acmed/src/config.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/acmed/src/config.rs b/acmed/src/config.rs index 05c6a32..3e9dc7b 100644 --- a/acmed/src/config.rs +++ b/acmed/src/config.rs @@ -279,19 +279,25 @@ pub struct Account { pub contacts: Vec, pub key_type: Option, pub signature_algorithm: Option, - pub hooks: Vec, + pub hooks: Option>, #[serde(default)] pub env: HashMap, } impl Account { pub fn get_hooks(&self, cnf: &Config) -> Result, Error> { - let mut res = vec![]; - for name in self.hooks.iter() { - let mut h = cnf.get_hook(&name)?; - res.append(&mut h); - } - Ok(res) + let lst = match &self.hooks { + Some(h) => { + let mut res = vec![]; + for name in h.iter() { + let mut h = cnf.get_hook(&name)?; + res.append(&mut h); + } + res + } + None => vec![], + }; + Ok(lst) } pub fn to_generic(&self, file_manager: &FileManager) -> Result {