fix: client and env are optional
This commit is contained in:
parent
1ac3301779
commit
c2159989b2
2 changed files with 4 additions and 4 deletions
|
@ -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
|
// 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 pattern = regex::Regex::new(query).expect("tested it before and still failed here???");
|
||||||
let mut joinset = tokio::task::JoinSet::new();
|
let mut joinset = tokio::task::JoinSet::new();
|
||||||
let client = std::sync::Arc::new(collection.client);
|
let client = std::sync::Arc::new(collection.client.unwrap_or_default());
|
||||||
let env = std::sync::Arc::new(collection.env);
|
let env = std::sync::Arc::new(collection.env.unwrap_or_default());
|
||||||
for (name, mut endpoint) in collection.route {
|
for (name, mut endpoint) in collection.route {
|
||||||
if pattern.find(&name).is_some() {
|
if pattern.find(&name).is_some() {
|
||||||
if *debug { endpoint.extract = Some(ext::StringOr::T(model::ExtractorConfig::Debug)) };
|
if *debug { endpoint.extract = Some(ext::StringOr::T(model::ExtractorConfig::Debug)) };
|
||||||
|
|
|
@ -8,8 +8,8 @@ pub use extractor::ExtractorConfig;
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct PostWomanCollection {
|
pub struct PostWomanCollection {
|
||||||
pub client: ClientConfig,
|
pub client: Option<ClientConfig>,
|
||||||
pub env: toml::Table,
|
pub env: Option<toml::Table>,
|
||||||
pub include: Option<Vec<String>>,
|
pub include: Option<Vec<String>>,
|
||||||
// it's weird to name it singular but makes more sense in config
|
// it's weird to name it singular but makes more sense in config
|
||||||
pub route: indexmap::IndexMap<String, EndpointConfig>,
|
pub route: indexmap::IndexMap<String, EndpointConfig>,
|
||||||
|
|
Loading…
Reference in a new issue