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

Update src/config/parser.rs

Co-authored-by: neon_arch <mustafadhuleb53@gmail.com>
This commit is contained in:
Łukasz Mariański 2024-10-04 06:21:11 +00:00 committed by GitHub
parent c07d9280be
commit 6464827834
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -123,14 +123,12 @@ impl Config {
_ => parsed_cet, _ => parsed_cet,
}; };
let proxy_str = globals.get::<_, String>("proxy")?; let proxy_opt = globals.get::<_, Option<String>>("proxy")?;
let proxy = match Proxy::all(proxy_str) { let proxy = proxy_opt.and_then(|proxy_str| {
Ok(proxy) => Some(proxy), Proxy::all(proxy_str).ok().and_then(|_| {
Err(_) => {
log::error!("Invalid proxy url, defaulting to no proxy."); log::error!("Invalid proxy url, defaulting to no proxy.");
None None
} })
};
Ok(Config { Ok(Config {
port: globals.get::<_, u16>("port")?, port: globals.get::<_, u16>("port")?,