fix: client and env are optional

This commit is contained in:
əlemi 2024-10-20 05:10:39 +02:00
parent 1ac3301779
commit c2159989b2
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 4 additions and 4 deletions

View file

@ -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)) };

View file

@ -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<ClientConfig>,
pub env: Option<toml::Table>,
pub include: Option<Vec<String>>,
// it's weird to name it singular but makes more sense in config
pub route: indexmap::IndexMap<String, EndpointConfig>,