api: add schema for http proxy configuration - HTTP_PROXY_SCHEMA

This commit is contained in:
Dietmar Maurer 2021-04-28 10:59:35 +02:00
parent 7a7fcb4715
commit 467bd01cdf

View File

@ -1610,3 +1610,14 @@ pub struct NodeStatus {
pub cpuinfo: NodeCpuInformation,
pub info: NodeInformation,
}
pub const HTTP_PROXY_SCHEMA: Schema = StringSchema::new(
"HTTP proxy configuration [http://]<host>[:port]")
.format(&ApiStringFormat::VerifyFn(|s| {
crate::tools::http::ProxyConfig::parse_proxy_url(s)?;
Ok(())
}))
.min_length(1)
.max_length(128)
.type_text("[http://]<host>[:port]")
.schema();