Skip to content

Commit

Permalink
Adding default port value if not provided.
Browse files Browse the repository at this point in the history
Rather than throwing error for invalid host address due to missing port,
default port is inserted at the end and validity is checked again.
  • Loading branch information
Zshan0 committed Jun 19, 2022
1 parent 0859e52 commit 9913268
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/installer/step/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ impl Step for DefineCoordinator {

self.host.valid = SocketAddr::from_str(&self.host.value).is_ok();

if !self.host.valid {
// trim spaces at the end if any.
let clean_value = self.host.value.trim_end();

let value = format!("{}:8383", clean_value).to_string();
self.host.valid = SocketAddr::from_str(&value).is_ok();
if self.host.valid {
self.host.value = value;
}
}

if !self.host.valid || !self.noise_key.valid {
return false;
}
Expand Down

0 comments on commit 9913268

Please sign in to comment.