diff --git a/fishctl/src/command/config/update/v1.rs b/fishctl/src/command/config/update/v1.rs index f95bd81..54e2fcf 100644 --- a/fishctl/src/command/config/update/v1.rs +++ b/fishctl/src/command/config/update/v1.rs @@ -364,6 +364,36 @@ fn create_new_server_config( } }; + let http_proxy_bypass_hosts = match default_yml.get("proxyBypassHosts") { + Some(hosts) => Some( + hosts + .as_vec() + .ok_or(Error::InvalidConfig("proxyBypassHosts is not an array"))? + .iter() + .map(|host| { + host.as_str() + .ok_or(Error::InvalidConfig( + "proxyBypassHosts contains non-string items", + )) + .map(|s| s.to_owned()) + }) + .collect::, Error>>()?, + ), + None => None, + }; + + let http_proxy = match default_yml.get("proxyUrl") { + Some(url) => Some(server::Proxy { + enabled: true, + url: url + .as_str() + .ok_or(Error::InvalidConfig("proxyUrl 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 { @@ -373,7 +403,7 @@ fn create_new_server_config( contact_info: meta.maintainer_email.to_owned(), open_registrations: !meta.disable_registration, repository_url, - default_reaction: meta.default_reaction.to_owned(), + default_reaction: Some(meta.default_reaction.to_owned()), }), timeline: Some(server::Timeline { local: !meta.disable_local_timeline, @@ -398,7 +428,7 @@ fn create_new_server_config( .and_then(|v| v.as_i64()) .ok_or(Error::InvalidConfig("port"))? as u16, }, - http_proxy: todo!(), + http_proxy, media_proxy: todo!(), summaly_proxy: todo!(), smtp_proxy: todo!(), diff --git a/fishctl/src/config/server.rs b/fishctl/src/config/server.rs index 38b689c..a751796 100644 --- a/fishctl/src/config/server.rs +++ b/fishctl/src/config/server.rs @@ -59,7 +59,7 @@ pub struct Proxy { pub enabled: bool, #[validate(url)] pub url: String, - pub allowlist: Option>, + pub bypass_hosts: Option>, } #[derive(Deserialize, Serialize, Validate, Debug, Clone)]