From 55555333ff9009dee1f36796dcd61b9f702a6bf7 Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Thu, 2 Jul 2020 10:02:13 +0700 Subject: [PATCH] Do subvalidation on the config --- src/config.rs | 1 + src/main.rs | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/config.rs b/src/config.rs index 230449f..576ea99 100644 --- a/src/config.rs +++ b/src/config.rs @@ -12,6 +12,7 @@ lazy_static! { #[derive(Debug, Deserialize, Validate, Clone)] pub struct Config { + #[validate] pub cameras: Vec, #[serde(rename = "bind", default = "default_bind_addr")] diff --git a/src/main.rs b/src/main.rs index 9f74799..ec7f9f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,12 +47,6 @@ fn main() -> Result<(), Error> { Ok(_) => (), Err(e) => return Err(Error::ValidationError(e)), }; - for camera in &config.cameras { - match camera.validate() { - Ok(_) => (), - Err(e) => return Err(Error::ValidationError(e)), - }; - } // Setup auto sub streams, we do this by looping the cameras // If the stream type is both we clone the config