mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-22 14:08:23 -05:00
🧹 chore: make github actions happy (#203)
This commit is contained in:
parent
30ca95a217
commit
b9d651c378
@ -36,6 +36,7 @@ pub struct Config {
|
|||||||
pub request_timeout: u8,
|
pub request_timeout: u8,
|
||||||
pub threads: u8,
|
pub threads: u8,
|
||||||
pub rate_limiter: RateLimiter,
|
pub rate_limiter: RateLimiter,
|
||||||
|
pub safe_search: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
@ -81,6 +82,16 @@ impl Config {
|
|||||||
|
|
||||||
let rate_limiter = globals.get::<_, HashMap<String, u8>>("rate_limiter")?;
|
let rate_limiter = globals.get::<_, HashMap<String, u8>>("rate_limiter")?;
|
||||||
|
|
||||||
|
let parsed_safe_search: u8 = globals.get::<_, u8>("safe_search")?;
|
||||||
|
let safe_search: u8 = match parsed_safe_search {
|
||||||
|
0..=4 => parsed_safe_search,
|
||||||
|
_ => {
|
||||||
|
log::error!("Config Error: The value of `safe_search` option should be a non zero positive integer from 0 to 4.");
|
||||||
|
log::error!("Falling back to using the value `1` for the option");
|
||||||
|
1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Config {
|
Ok(Config {
|
||||||
port: globals.get::<_, u16>("port")?,
|
port: globals.get::<_, u16>("port")?,
|
||||||
binding_ip: globals.get::<_, String>("binding_ip")?,
|
binding_ip: globals.get::<_, String>("binding_ip")?,
|
||||||
@ -105,7 +116,8 @@ impl Config {
|
|||||||
rate_limiter: RateLimiter {
|
rate_limiter: RateLimiter {
|
||||||
number_of_requests: rate_limiter["number_of_requests"],
|
number_of_requests: rate_limiter["number_of_requests"],
|
||||||
time_limit: rate_limiter["time_limit"],
|
time_limit: rate_limiter["time_limit"],
|
||||||
}
|
},
|
||||||
|
safe_search,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user