mirror of https://github.com/mastodon/flodgatt
Treat env vars set to "" as if they were unset (#73)
* Treat env vars set to "" as if they were unset * Bump version to 0.4.4
This commit is contained in:
parent
07e8776090
commit
bf529a901b
|
@ -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)",
|
||||
|
|
|
@ -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 <daniel@codesections.com", "Julian Laubstein <contact@julianlaubstein.de>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
|
@ -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
|
||||
// }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue