Fix unified config in web
This commit is contained in:
parent
df356da498
commit
8ac99c154f
|
@ -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<Box<dyn Backend>> {
|
||||
// TODO deduplicate with the indexer crate
|
||||
match &self.index {
|
||||
match &self.index.backend {
|
||||
BackendConfig::Tantivy(tantivy) => {
|
||||
Ok(Box::new(TantivyBackend::open(&tantivy.index_dir)?))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue