Skip to content

Commit

Permalink
Do not error on the listen port not set, for override-endpoint --unset
Browse files Browse the repository at this point in the history
  • Loading branch information
skywhale committed Aug 7, 2024
1 parent dbac0dc commit 96a32ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,14 +1002,14 @@ fn override_endpoint(
sub_opts: OverrideEndpointOpts,
) -> Result<(), Error> {
let config = InterfaceConfig::from_interface(&opts.config_dir, interface)?;
let port = match config.interface.listen_port {
Some(port) => port,
None => bail!("you need to set a listen port with set-listen-port before overriding the endpoint (otherwise port randomization on the interface would make it useless).")
};

let endpoint_contents = if sub_opts.unset {
prompts::unset_override_endpoint(&sub_opts)?.then_some(EndpointContents::Unset)
} else {
let port = match config.interface.listen_port {
Some(port) => port,
None => bail!("you need to set a listen port with set-listen-port before overriding the endpoint (otherwise port randomization on the interface would make it useless).")
};
let endpoint = prompts::override_endpoint(&sub_opts, port)?;
endpoint.map(EndpointContents::Set)
};
Expand Down

0 comments on commit 96a32ce

Please sign in to comment.