aboutsummaryrefslogtreecommitdiff
path: root/src/config
diff options
context:
space:
mode:
authoradrien <adrien@luxeylab.net>2021-09-10 18:41:39 +0200
committeradrien <adrien@luxeylab.net>2021-09-10 18:41:39 +0200
commit4d76c3d78ade04038593aeef867294c9eee2a4b8 (patch)
tree8fac4937beafb831b7354bb2afa37bb5bea99e00 /src/config
parent195aec2cfe738f4025ea540d2591f876e1d209b9 (diff)
downloaddiplonat-4d76c3d78ade04038593aeef867294c9eee2a4b8.tar.gz
diplonat-4d76c3d78ade04038593aeef867294c9eee2a4b8.zip
wrote the skeleton of ACME. Involved solving the cosmetic warnings about CamelCase for enums (without changing the API).
Diffstat (limited to 'src/config')
-rw-r--r--src/config/options.rs2
-rw-r--r--src/config/runtime.rs4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/config/options.rs b/src/config/options.rs
index b3a63b0..54e948d 100644
--- a/src/config/options.rs
+++ b/src/config/options.rs
@@ -34,6 +34,8 @@ pub struct ConfigOptsAcme {
/// The default domain holder's e-mail [default: None]
pub email: Option<String>,
+ /// Refresh time for firewall rules [default: 300]
+ pub refresh_time: Option<u16>,
}
/// Firewall configuration options
diff --git a/src/config/runtime.rs b/src/config/runtime.rs
index f83a6b5..ee7f682 100644
--- a/src/config/runtime.rs
+++ b/src/config/runtime.rs
@@ -20,6 +20,7 @@ pub struct RuntimeConfigConsul {
#[derive(Debug)]
pub struct RuntimeConfigAcme {
pub email: String,
+ pub refresh_time: Duration,
}
#[derive(Debug)]
@@ -79,9 +80,12 @@ impl RuntimeConfigAcme {
let email = opts.email.expect(
"'DIPLONAT_ACME_EMAIL' is required if ACME is enabled");
+ let refresh_time = Duration::from_secs(
+ opts.refresh_time.unwrap_or(super::REFRESH_TIME).into());
Ok(Some(Self {
email,
+ refresh_time,
}))
}
}