From d62d222034acda197116a2a5dcad0051652b0ada Mon Sep 17 00:00:00 2001 From: librelois Date: Sat, 8 May 2021 16:39:45 +0200 Subject: [PATCH] feat(conf): gva can now be enabled with one unique env var --- conf/src/lib.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/conf/src/lib.rs b/conf/src/lib.rs index 11594fd..96ccd28 100644 --- a/conf/src/lib.rs +++ b/conf/src/lib.rs @@ -41,6 +41,7 @@ pub struct GvaConf { pub remote_path: Option, pub remote_subscriptions_path: Option, pub remote_tls: Option, + #[serde(default = "whitelist_default")] pub whitelist: Vec, } @@ -64,6 +65,13 @@ fn subscriptions_path_default() -> String { "gva-sub".to_owned() } +fn whitelist_default() -> Vec { + vec![ + IpAddr::V4(Ipv4Addr::LOCALHOST), + IpAddr::V6(Ipv6Addr::LOCALHOST), + ] +} + impl Default for GvaConf { fn default() -> Self { GvaConf { @@ -78,10 +86,7 @@ impl Default for GvaConf { remote_path: None, remote_subscriptions_path: None, remote_tls: None, - whitelist: vec![ - IpAddr::V4(Ipv4Addr::LOCALHOST), - IpAddr::V6(Ipv6Addr::LOCALHOST), - ], + whitelist: whitelist_default(), } } }