neon_arch commited on
Commit
ff79c1f
1 Parent(s): 7def296

✨ feat: code to parse and handle the new config option

Browse files
Files changed (1) hide show
  1. src/config_parser/parser.rs +7 -1
src/config_parser/parser.rs CHANGED
@@ -3,7 +3,7 @@
3
 
4
  use super::parser_models::Style;
5
  use rlua::Lua;
6
- use std::{format, fs, path::Path};
7
 
8
  // ------- Constants --------
9
  static COMMON_DIRECTORY_NAME: &str = "websurfx";
@@ -27,6 +27,7 @@ pub struct Config {
27
  pub aggregator: AggreatorConfig,
28
  pub logging: bool,
29
  pub debug: bool,
 
30
  }
31
 
32
  /// Configuration options for the aggregator.
@@ -75,6 +76,11 @@ impl Config {
75
  aggregator: aggregator_config,
76
  logging: globals.get::<_, bool>("logging")?,
77
  debug: globals.get::<_, bool>("debug")?,
 
 
 
 
 
78
  })
79
  })
80
  }
 
3
 
4
  use super::parser_models::Style;
5
  use rlua::Lua;
6
+ use std::{collections::HashMap, format, fs, path::Path};
7
 
8
  // ------- Constants --------
9
  static COMMON_DIRECTORY_NAME: &str = "websurfx";
 
27
  pub aggregator: AggreatorConfig,
28
  pub logging: bool,
29
  pub debug: bool,
30
+ pub upstream_search_engines: Vec<String>,
31
  }
32
 
33
  /// Configuration options for the aggregator.
 
76
  aggregator: aggregator_config,
77
  logging: globals.get::<_, bool>("logging")?,
78
  debug: globals.get::<_, bool>("debug")?,
79
+ upstream_search_engines: globals
80
+ .get::<_, HashMap<String, bool>>("upstream_search_engines")?
81
+ .into_iter()
82
+ .filter_map(|(key, value)| value.then(|| key))
83
+ .collect(),
84
  })
85
  })
86
  }