From cc6f5546babae21feb81468be2e317b67926e70e Mon Sep 17 00:00:00 2001 From: karel Date: Tue, 12 Sep 2023 16:21:15 +0100 Subject: [PATCH] feat(hubble): make indexers a json value --- hubble/src/cli.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hubble/src/cli.rs b/hubble/src/cli.rs index 198aa676ad..827517208a 100644 --- a/hubble/src/cli.rs +++ b/hubble/src/cli.rs @@ -17,7 +17,20 @@ pub struct Args { pub secret: String, /// Indexer configurations to start. #[arg(short, long, env = "HUBBLE_INDEXERS")] - pub indexers: Vec, + pub indexers: Indexers, +} + +#[derive(Clone, Debug, serde::Deserialize)] +pub struct Indexers(Vec); + +impl IntoIterator for Indexers { + type Item = IndexerConfig; + + type IntoIter = std::vec::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.0.into_iter() + } } #[derive(Clone, Debug, serde::Deserialize)] @@ -34,7 +47,7 @@ impl IndexerConfig { } } -impl FromStr for IndexerConfig { +impl FromStr for Indexers { type Err = color_eyre::eyre::Error; fn from_str(item: &str) -> Result::Err> {