neon_arch commited on
Commit
8c239e2
โ€ข
1 Parent(s): 578c7bc

๐Ÿ› ๏ธ fix: make the redis_url option only available on `redis-cache` feature (#244)

Browse files
src/config/parser.rs CHANGED
@@ -17,9 +17,10 @@ pub struct Config {
17
  pub binding_ip: String,
18
  /// It stores the theming options for the website.
19
  pub style: Style,
 
20
  /// It stores the redis connection url address on which the redis
21
  /// client should connect.
22
- pub redis_url: Option<String>,
23
  /// It stores the option to whether enable or disable production use.
24
  pub aggregator: AggregatorConfig,
25
  /// It stores the option to whether enable or disable logs.
@@ -99,7 +100,8 @@ impl Config {
99
  globals.get::<_, String>("theme")?,
100
  globals.get::<_, String>("colorscheme")?,
101
  ),
102
- redis_url: globals.get::<_, String>("redis_url").ok(),
 
103
  aggregator: AggregatorConfig {
104
  random_delay: globals.get::<_, bool>("production_use")?,
105
  },
 
17
  pub binding_ip: String,
18
  /// It stores the theming options for the website.
19
  pub style: Style,
20
+ #[cfg(feature = "redis-cache")]
21
  /// It stores the redis connection url address on which the redis
22
  /// client should connect.
23
+ pub redis_url: String,
24
  /// It stores the option to whether enable or disable production use.
25
  pub aggregator: AggregatorConfig,
26
  /// It stores the option to whether enable or disable logs.
 
100
  globals.get::<_, String>("theme")?,
101
  globals.get::<_, String>("colorscheme")?,
102
  ),
103
+ #[cfg(feature = "redis-cache")]
104
+ redis_url: globals.get::<_, String>("redis_url")?,
105
  aggregator: AggregatorConfig {
106
  random_delay: globals.get::<_, bool>("production_use")?,
107
  },
src/models/server_models.rs CHANGED
@@ -11,16 +11,19 @@ pub struct SearchParams {
11
  /// It stores the search parameter `page` (or pageno in simple words)
12
  /// of the search url.
13
  pub page: Option<u32>,
 
 
 
14
  }
15
 
16
  /// A named struct which is used to deserialize the cookies fetched from the client side.
17
  #[allow(dead_code)]
18
  #[derive(Deserialize)]
19
- pub struct Cookie {
20
  /// It stores the theme name used in the website.
21
- pub theme: String,
22
  /// It stores the colorscheme name used for the website theme.
23
- pub colorscheme: String,
24
  /// It stores the user selected upstream search engines selected from the UI.
25
- pub engines: Vec<String>,
26
  }
 
11
  /// It stores the search parameter `page` (or pageno in simple words)
12
  /// of the search url.
13
  pub page: Option<u32>,
14
+ /// It stores the search parameter `safesearch` (or safe search level in simple words) of the
15
+ /// search url.
16
+ pub safesearch: Option<u8>,
17
  }
18
 
19
  /// A named struct which is used to deserialize the cookies fetched from the client side.
20
  #[allow(dead_code)]
21
  #[derive(Deserialize)]
22
+ pub struct Cookie<'a> {
23
  /// It stores the theme name used in the website.
24
+ pub theme: &'a str,
25
  /// It stores the colorscheme name used for the website theme.
26
+ pub colorscheme: &'a str,
27
  /// It stores the user selected upstream search engines selected from the UI.
28
+ pub engines: Vec<&'a str>,
29
  }