From c2159989b29fb886893f0c38004d48d38f5182dc Mon Sep 17 00:00:00 2001 From: alemi Date: Sun, 20 Oct 2024 05:10:39 +0200 Subject: [PATCH] fix: client and env are optional --- src/main.rs | 4 ++-- src/model/mod.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index e014b60..b5d177a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -154,8 +154,8 @@ async fn run_postwoman(args: &PostWomanArgs, name: String, collection: PostWoman // this is always safe to compile because we tested it beforehand let pattern = regex::Regex::new(query).expect("tested it before and still failed here???"); let mut joinset = tokio::task::JoinSet::new(); - let client = std::sync::Arc::new(collection.client); - let env = std::sync::Arc::new(collection.env); + let client = std::sync::Arc::new(collection.client.unwrap_or_default()); + let env = std::sync::Arc::new(collection.env.unwrap_or_default()); for (name, mut endpoint) in collection.route { if pattern.find(&name).is_some() { if *debug { endpoint.extract = Some(ext::StringOr::T(model::ExtractorConfig::Debug)) }; diff --git a/src/model/mod.rs b/src/model/mod.rs index 8a32d65..2a7f263 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -8,8 +8,8 @@ pub use extractor::ExtractorConfig; #[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)] pub struct PostWomanCollection { - pub client: ClientConfig, - pub env: toml::Table, + pub client: Option, + pub env: Option, pub include: Option>, // it's weird to name it singular but makes more sense in config pub route: indexmap::IndexMap,