From c39d9ff0b08621ff40a68389a3fafe98ae91e431 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 18 Nov 2023 21:46:36 +0300 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20rewrite=20the?= =?UTF-8?q?=20parsing=20of=20the=20upstream=20search=20engines=20option=20?= =?UTF-8?q?(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/parser.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/config/parser.rs b/src/config/parser.rs index 0acdd25..1b8ba16 100644 --- a/src/config/parser.rs +++ b/src/config/parser.rs @@ -3,7 +3,6 @@ use crate::handler::paths::{file_path, FileType}; -use crate::models::engine_models::{EngineError, EngineHandler}; use crate::models::parser_models::{AggregatorConfig, RateLimiter, Style}; use log::LevelFilter; use mlua::Lua; @@ -29,7 +28,7 @@ pub struct Config { /// It stores the option to whether enable or disable debug mode. pub debug: bool, /// It stores all the engine names that were enabled by the user. - pub upstream_search_engines: Vec, + pub upstream_search_engines: HashMap, /// It stores the time (secs) which controls the server request timeout. pub request_timeout: u8, /// It stores the number of threads which controls the app will use to run. @@ -109,11 +108,7 @@ impl Config { logging, debug, upstream_search_engines: globals - .get::<_, HashMap>("upstream_search_engines")? - .into_iter() - .filter_map(|(key, value)| value.then_some(key)) - .map(|engine| EngineHandler::new(&engine)) - .collect::, error_stack::Report>>()?, + .get::<_, HashMap>("upstream_search_engines")?, request_timeout: globals.get::<_, u8>("request_timeout")?, threads, rate_limiter: RateLimiter {