feat: mirror can set none

This commit is contained in:
2020-11-22 09:54:43 +08:00
parent b3d6a603d6
commit 77aeb02331
2 changed files with 3 additions and 3 deletions

View File

@@ -48,8 +48,8 @@ impl DockerCmd {
self
}
pub fn mirror(&mut self, mirror: &str) -> &mut Self {
self.mirror = Some(mirror.into());
pub fn mirror(&mut self, mirror: &Option<&str>) -> &mut Self {
self.mirror = mirror.map(|s| s.into());
self
}

View File

@@ -54,7 +54,7 @@ fn main() {
docker_cmd.add_volumn(&get_final_docker_registry(&docker_image), "/usr/local/cargo/registry");
if let Some(mirror) = &crates_mirror.or(docker_build_config.mirror) {
if mirror.to_lowercase() != "none" {
docker_cmd.mirror(mirror);
docker_cmd.mirror(&Some(mirror));
}
}
docker_cmd.exec(&args).unwrap();