aboutsummaryrefslogtreecommitdiff
path: root/src/config/runtime.rs
diff options
context:
space:
mode:
authorQuentin <quentin@dufour.io>2021-09-20 16:06:02 +0200
committerQuentin <quentin@dufour.io>2021-09-20 16:06:02 +0200
commit4d4d453afa3edafe71db2ae60171b8696b38a3c9 (patch)
tree64a54012efbac76bca6c5f0d8214fdae44743bc8 /src/config/runtime.rs
parent2bbc9109991f8bb79a09a965a1d2779e1749b25b (diff)
parent68cb4d5482649baca3a79d3fd0e3449a6af0533b (diff)
downloaddiplonat-4d4d453afa3edafe71db2ae60171b8696b38a3c9.tar.gz
diplonat-4d4d453afa3edafe71db2ae60171b8696b38a3c9.zip
Merge pull request 'Extensively use rustfmt' (#11) from quality/rustfmt into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/diplonat/pulls/11
Diffstat (limited to 'src/config/runtime.rs')
-rw-r--r--src/config/runtime.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/config/runtime.rs b/src/config/runtime.rs
index 0d52b15..eeb34f6 100644
--- a/src/config/runtime.rs
+++ b/src/config/runtime.rs
@@ -6,8 +6,8 @@ use crate::config::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul
// This code is inspired by the Trunk crate (https://github.com/thedodd/trunk)
-// In this file, we take ConfigOpts and transform them into ready-to-use RuntimeConfig.
-// We apply default values and business logic.
+// In this file, we take ConfigOpts and transform them into ready-to-use
+// RuntimeConfig. We apply default values and business logic.
#[derive(Debug)]
pub struct RuntimeConfigAcme {
@@ -59,12 +59,11 @@ impl RuntimeConfig {
impl RuntimeConfigAcme {
pub fn new(opts: ConfigOptsAcme) -> Result<Option<Self>> {
if !opts.enable {
- return Ok(None);
+ return Ok(None)
}
let email = opts.email.expect(
- "'DIPLONAT_ACME_EMAIL' environment variable is required \
- if 'DIPLONAT_ACME_ENABLE' == 'true'",
+ "'DIPLONAT_ACME_EMAIL' environment variable is required if 'DIPLONAT_ACME_ENABLE' == 'true'",
);
Ok(Some(Self { email }))
@@ -105,9 +104,11 @@ impl RuntimeConfigIgd {
if refresh_time.as_secs() * 2 > expiration_time.as_secs() {
return Err(anyhow!(
- "IGD expiration time (currently: {}s) must be at least twice bigger than refresh time (currently: {}s)",
- expiration_time.as_secs(),
- refresh_time.as_secs()));
+ "IGD expiration time (currently: {}s) must be at least twice bigger than refresh time \
+ (currently: {}s)",
+ expiration_time.as_secs(),
+ refresh_time.as_secs()
+ ))
}
Ok(Self {