Refactor ProxyOverides to be optional
This commit is contained in:
+7
-7
@@ -78,12 +78,12 @@ async fn main() -> Result<()> {
|
||||
.map_err(|e| anyhow!("could not install crypto provider {e:?}"))?;
|
||||
|
||||
let mut client_config = ProxyOverides {
|
||||
proxy_url: match &server_config.proxy_url {
|
||||
Some(url) => Some(url.to_string()),
|
||||
None => None,
|
||||
},
|
||||
cert_hash: None,
|
||||
any_server: false,
|
||||
proxy_url: server_config
|
||||
.proxy_url
|
||||
.as_ref()
|
||||
.map(|url| url.to_string())
|
||||
.unwrap_or_default(),
|
||||
cert_hash: Vec::new(),
|
||||
};
|
||||
|
||||
let (cert, key) = match (&server_config.cert_path, &server_config.key_path) {
|
||||
@@ -102,7 +102,7 @@ async fn main() -> Result<()> {
|
||||
let cert = cert_params.self_signed(&key_pair)?;
|
||||
|
||||
let hash = hmac_sha256::Hash::hash(cert.der().as_ref());
|
||||
client_config.cert_hash = Some(hash.into());
|
||||
client_config.cert_hash = hash.into();
|
||||
|
||||
(cert.pem().into(), key_pair.serialize_pem().into())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user