From 988688c8d9b11a69d8e0c2e445b4a9db20aac33c Mon Sep 17 00:00:00 2001 From: naskya Date: Mon, 1 Jul 2024 10:56:04 +0900 Subject: [PATCH] WIP --- fishctl/src/command/config/update/v1.rs | 34 +++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/fishctl/src/command/config/update/v1.rs b/fishctl/src/command/config/update/v1.rs index 861d1fc..b23c167 100644 --- a/fishctl/src/command/config/update/v1.rs +++ b/fishctl/src/command/config/update/v1.rs @@ -389,7 +389,19 @@ fn create_new_server_config( .as_str() .ok_or(Error::InvalidConfig("`proxyUrl` is not a string"))? .to_string(), - bypass_hosts: http_proxy_bypass_hosts, + bypass_hosts: http_proxy_bypass_hosts.clone(), + }), + None => None, + }; + + let media_proxy = match default_yml.get("mediaProxy") { + Some(url) => Some(server::Proxy { + enabled: true, + url: url + .as_str() + .ok_or(Error::InvalidConfig("`mediaProxy` is not a string"))? + .to_string(), + bypass_hosts: http_proxy_bypass_hosts.clone(), }), None => None, }; @@ -397,9 +409,21 @@ fn create_new_server_config( let summaly_proxy = meta.summaly_proxy.as_ref().map(|url| server::Proxy { enabled: true, url: url.to_owned(), - bypass_hosts: None, + bypass_hosts: http_proxy_bypass_hosts.clone(), }); + let smtp_proxy = match default_yml.get("proxySmtp") { + Some(url) => Some(server::Proxy { + enabled: true, + url: url + .as_str() + .ok_or(Error::InvalidConfig("`proxySmtp` is not a string"))? + .to_string(), + bypass_hosts: http_proxy_bypass_hosts, + }), + None => None, + }; + let mut server_config = server::Config { config_revision: Revision::V1, server_info: Some(server::ServerInfo { @@ -435,9 +459,9 @@ fn create_new_server_config( .ok_or(Error::InvalidConfig("port"))? as u16, }, http_proxy, - media_proxy: todo!(), - summaly_proxy: summaly_proxy, - smtp_proxy: todo!(), + media_proxy, + summaly_proxy, + smtp_proxy, }, database: server::Database { host: db