🧹 chore: make github actions happy (#203)
This commit is contained in:
parent
30ca95a217
commit
b9d651c378
1 changed files with 37 additions and 25 deletions
|
@ -36,6 +36,7 @@ pub struct Config {
|
|||
pub request_timeout: u8,
|
||||
pub threads: u8,
|
||||
pub rate_limiter: RateLimiter,
|
||||
pub safe_search: u8,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
@ -81,6 +82,16 @@ impl Config {
|
|||
|
||||
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 {
|
||||
port: globals.get::<_, u16>("port")?,
|
||||
binding_ip: globals.get::<_, String>("binding_ip")?,
|
||||
|
@ -105,7 +116,8 @@ impl Config {
|
|||
rate_limiter: RateLimiter {
|
||||
number_of_requests: rate_limiter["number_of_requests"],
|
||||
time_limit: rate_limiter["time_limit"],
|
||||
}
|
||||
},
|
||||
safe_search,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue