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

🛠️ fix: make the redis_url option only available on redis-cache feature (#244)

This commit is contained in:
neon_arch 2023-09-17 12:48:52 +03:00
parent 578c7bcf77
commit 8c239e2313
2 changed files with 11 additions and 6 deletions

View File

@ -17,9 +17,10 @@ pub struct Config {
pub binding_ip: String,
/// It stores the theming options for the website.
pub style: Style,
#[cfg(feature = "redis-cache")]
/// It stores the redis connection url address on which the redis
/// client should connect.
pub redis_url: Option<String>,
pub redis_url: String,
/// It stores the option to whether enable or disable production use.
pub aggregator: AggregatorConfig,
/// It stores the option to whether enable or disable logs.
@ -99,7 +100,8 @@ impl Config {
globals.get::<_, String>("theme")?,
globals.get::<_, String>("colorscheme")?,
),
redis_url: globals.get::<_, String>("redis_url").ok(),
#[cfg(feature = "redis-cache")]
redis_url: globals.get::<_, String>("redis_url")?,
aggregator: AggregatorConfig {
random_delay: globals.get::<_, bool>("production_use")?,
},

View File

@ -11,16 +11,19 @@ pub struct SearchParams {
/// It stores the search parameter `page` (or pageno in simple words)
/// of the search url.
pub page: Option<u32>,
/// It stores the search parameter `safesearch` (or safe search level in simple words) of the
/// search url.
pub safesearch: Option<u8>,
}
/// A named struct which is used to deserialize the cookies fetched from the client side.
#[allow(dead_code)]
#[derive(Deserialize)]
pub struct Cookie {
pub struct Cookie<'a> {
/// It stores the theme name used in the website.
pub theme: String,
pub theme: &'a str,
/// It stores the colorscheme name used for the website theme.
pub colorscheme: String,
pub colorscheme: &'a str,
/// It stores the user selected upstream search engines selected from the UI.
pub engines: Vec<String>,
pub engines: Vec<&'a str>,
}