diff --git a/src/config_parser/parser.rs b/src/config_parser/parser.rs index 21a9bf5..4b73a73 100644 --- a/src/config_parser/parser.rs +++ b/src/config_parser/parser.rs @@ -49,7 +49,16 @@ impl Config { .load(&fs::read_to_string("./websurfx/config.lua")?) .exec()?; - let aggregator_config = globals.get::<_, rlua::Table>("aggregator")?; + let production_use = globals.get::<_, bool>("production_use")?; + let aggregator_config = if production_use { + AggreatorConfig { + random_delay: true, + } + } else { + AggreatorConfig { + random_delay: false, + } + }; Ok(Config { port: globals.get::<_, u16>("port")?, @@ -59,9 +68,7 @@ impl Config { globals.get::<_, String>("colorscheme")?, ), redis_connection_url: globals.get::<_, String>("redis_connection_url")?, - aggregator: AggreatorConfig { - random_delay: aggregator_config.get::<_, bool>("random_delay")?, - }, + aggregator: aggregator_config }) }) } diff --git a/websurfx/config.lua b/websurfx/config.lua index 7dfd515..1c0be7d 100644 --- a/websurfx/config.lua +++ b/websurfx/config.lua @@ -20,7 +20,6 @@ theme = "simple" -- the theme name which should be used for the website -- Caching redis_connection_url = "redis://127.0.0.1:8082" -- redis connection url address on which the client should connect on. --- Aggregator -aggregator = { - random_delay = false, -- whether to add random delay before sending the request to the search engine -} \ No newline at end of file +production_use = false -- whether to use production mode or not +-- if production_use is set to true + -- there will be a random delay before sending the request to the search engines, this is to prevent the search engines from blocking the ip address \ No newline at end of file