From 8ac99c154ffa3ddb11f7c5d79c8b6ec5351ca1aa Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Wed, 6 Apr 2022 21:50:17 +0100 Subject: [PATCH] Fix unified config in web --- quickpeep/src/config.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/quickpeep/src/config.rs b/quickpeep/src/config.rs index 75adac3..2dc3674 100644 --- a/quickpeep/src/config.rs +++ b/quickpeep/src/config.rs @@ -16,7 +16,13 @@ pub struct SeedCollectionConfig { #[derive(Debug, Clone, Deserialize)] pub struct WebConfig { pub web: WebOnlyConfig, - pub index: BackendConfig, + pub index: IndexConfig, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct IndexConfig { + pub backend: BackendConfig, + // TODO icon_store } #[derive(Debug, Clone, Deserialize)] @@ -36,7 +42,7 @@ impl WebConfig { let mut web_config: WebConfig = ron::de::from_bytes(&file_bytes).context("Failed to parse web config")?; - match &mut web_config.index { + match &mut web_config.index.backend { BackendConfig::Tantivy(tantivy) => { tantivy.index_dir = config_dir.join(&tantivy.index_dir); } @@ -48,7 +54,7 @@ impl WebConfig { pub fn open_indexer_backend(&self) -> anyhow::Result> { // TODO deduplicate with the indexer crate - match &self.index { + match &self.index.backend { BackendConfig::Tantivy(tantivy) => { Ok(Box::new(TantivyBackend::open(&tantivy.index_dir)?)) }