From 6464827834e107408572e074ea28c62d53b6c440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Maria=C5=84ski?= <13919176+m00nwtchr@users.noreply.github.com> Date: Fri, 4 Oct 2024 06:21:11 +0000 Subject: [PATCH] Update src/config/parser.rs Co-authored-by: neon_arch --- src/config/parser.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/config/parser.rs b/src/config/parser.rs index d9c5c5e..e51f5ed 100644 --- a/src/config/parser.rs +++ b/src/config/parser.rs @@ -123,14 +123,12 @@ impl Config { _ => parsed_cet, }; - let proxy_str = globals.get::<_, String>("proxy")?; - let proxy = match Proxy::all(proxy_str) { - Ok(proxy) => Some(proxy), - Err(_) => { + let proxy_opt = globals.get::<_, Option>("proxy")?; + let proxy = proxy_opt.and_then(|proxy_str| { + Proxy::all(proxy_str).ok().and_then(|_| { log::error!("Invalid proxy url, defaulting to no proxy."); None - } - }; + }) Ok(Config { port: globals.get::<_, u16>("port")?,