From becfefd1ab12a481778f16d978a4a01f96695131 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Mon, 11 May 2020 15:01:54 -0700 Subject: [PATCH] Ensure that the settings load properly, and default to a None regex field This was broken in 0.1.7 because I didn't run a manual integration test, oops Yay automation --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/settings.rs | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) 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());