feat(updater)!: add option to use insecure transport protocol (#1814)

This commit is contained in:
Amr Bashir authored and GitHub committed 2024-09-24 18:38:53 +03:00
1 parent e564e2aa91
commit 04a0aea0ab
5 files changed
+71 -31

No files matched your search

+8 -3
View File
@@ -148,9 +148,14 @@ impl UpdaterBuilder {
self
}
pub fn endpoints(mut self, endpoints: Vec<Url>) -> Self {
pub fn endpoints(mut self, endpoints: Vec<Url>) -> Result<Self> {
crate::config::validate_endpoints(
&endpoints,
self.config.dangerous_insecure_transport_protocol,
)?;
self.endpoints.replace(endpoints);
self
Ok(self)
}
pub fn executable_path<P: AsRef<Path>>(mut self, p: P) -> Self {
@@ -219,7 +224,7 @@ impl UpdaterBuilder {
pub fn build(self) -> Result<Updater> {
let endpoints = self
.endpoints
.unwrap_or_else(|| self.config.endpoints.iter().map(|e| e.0.clone()).collect());
.unwrap_or_else(|| self.config.endpoints.clone());
if endpoints.is_empty() {
return Err(Error::EmptyEndpoints);