0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-22 05:58:21 -05:00

feat: code to parse and handle the new config option

This commit is contained in:
neon_arch 2023-07-11 19:38:59 +03:00
parent 7def2964b7
commit ff79c1fcfb

View File

@ -3,7 +3,7 @@
use super::parser_models::Style;
use rlua::Lua;
use std::{format, fs, path::Path};
use std::{collections::HashMap, format, fs, path::Path};
// ------- Constants --------
static COMMON_DIRECTORY_NAME: &str = "websurfx";
@ -27,6 +27,7 @@ pub struct Config {
pub aggregator: AggreatorConfig,
pub logging: bool,
pub debug: bool,
pub upstream_search_engines: Vec<String>,
}
/// Configuration options for the aggregator.
@ -75,6 +76,11 @@ impl Config {
aggregator: aggregator_config,
logging: globals.get::<_, bool>("logging")?,
debug: globals.get::<_, bool>("debug")?,
upstream_search_engines: globals
.get::<_, HashMap<String, bool>>("upstream_search_engines")?
.into_iter()
.filter_map(|(key, value)| value.then(|| key))
.collect(),
})
})
}