diff --git a/Cargo.lock b/Cargo.lock index 19cf9ac..75c52fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -404,7 +404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "flodgatt" -version = "0.4.3" +version = "0.4.4" dependencies = [ "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 20132f5..229da5d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "flodgatt" description = "A blazingly fast drop-in replacement for the Mastodon streaming api server" -version = "0.4.3" +version = "0.4.4" authors = ["Daniel Long Sockwell "] edition = "2018" diff --git a/src/config/mod.rs b/src/config/mod.rs index 01dd633..b2b314d 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -117,13 +117,21 @@ macro_rules! from_env_var { $body } pub fn maybe_update(self, var: Option<&String>) -> Self { - if let Some(value) = var { - Self(Self::inner_from_str(value).unwrap_or_else(|| { + match var { + Some(empty_string) if empty_string.is_empty() => Self::default(), + Some(value) => Self(Self::inner_from_str(value).unwrap_or_else(|| { crate::err::env_var_fatal($env_var, value, $allowed_values) - })) - } else { - self + })), + None => self, } + + // if let Some(value) = var { + // Self(Self::inner_from_str(value).unwrap_or_else(|| { + // crate::err::env_var_fatal($env_var, value, $allowed_values) + // })) + // } else { + // self + // } } } };