diff --git a/Cargo.lock b/Cargo.lock index f005b80..feb16a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -517,7 +517,7 @@ dependencies = [ [[package]] name = "hotdog" -version = "0.1.7" +version = "0.1.8" dependencies = [ "async-std", "async-tls", diff --git a/Cargo.toml b/Cargo.toml index 1fdc153..336621b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hotdog" -version = "0.1.7" +version = "0.1.8" authors = ["R. Tyler Croy "] edition = "2018" diff --git a/src/settings.rs b/src/settings.rs index 6816b22..cb4d00e 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -67,7 +67,7 @@ pub enum Action { pub struct Rule { pub field: Field, pub actions: Vec, - #[serde(with = "serde_regex")] + #[serde(with = "serde_regex", default = "default_none")] pub regex: Option, #[serde(default = "empty_str")] pub jmespath: String, @@ -152,10 +152,19 @@ fn kafka_timeout_default() -> Duration { Duration::from_secs(30) } +fn default_none() -> Option { + None +} + #[cfg(test)] mod tests { use super::*; + #[test] + fn test_load_example_config() { + load("hotdog.yml"); + } + #[test] fn test_default_tls() { assert_eq!(TlsType::None, TlsType::default());