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:
parent
7def2964b7
commit
ff79c1fcfb
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
use super::parser_models::Style;
|
use super::parser_models::Style;
|
||||||
use rlua::Lua;
|
use rlua::Lua;
|
||||||
use std::{format, fs, path::Path};
|
use std::{collections::HashMap, format, fs, path::Path};
|
||||||
|
|
||||||
// ------- Constants --------
|
// ------- Constants --------
|
||||||
static COMMON_DIRECTORY_NAME: &str = "websurfx";
|
static COMMON_DIRECTORY_NAME: &str = "websurfx";
|
||||||
@ -27,6 +27,7 @@ pub struct Config {
|
|||||||
pub aggregator: AggreatorConfig,
|
pub aggregator: AggreatorConfig,
|
||||||
pub logging: bool,
|
pub logging: bool,
|
||||||
pub debug: bool,
|
pub debug: bool,
|
||||||
|
pub upstream_search_engines: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Configuration options for the aggregator.
|
/// Configuration options for the aggregator.
|
||||||
@ -75,6 +76,11 @@ impl Config {
|
|||||||
aggregator: aggregator_config,
|
aggregator: aggregator_config,
|
||||||
logging: globals.get::<_, bool>("logging")?,
|
logging: globals.get::<_, bool>("logging")?,
|
||||||
debug: globals.get::<_, bool>("debug")?,
|
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(),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user