Skip to content

Commit

Permalink
drivers: Do not require arg2
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Sep 7, 2024
1 parent dcf66a9 commit bd9565a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/drivers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,17 @@ pub trait DriverExt: Sync + Send {
port = Some(number);
} else {
host = legacy_entry.arg1.clone();
let Some(arg2) = legacy_entry.arg2 else {
return Err(format!("Missing port in legacy entry: {debug_entry:?}"));
};

match arg2.parse::<u16>() {
Ok(number) => port = Some(number),
Err(error) => {
debug!("{error} for arg2: {arg2}, using url argument");
argument = Some(arg2);
}
if let Some(arg2) = legacy_entry.arg2 {
match arg2.parse::<u16>() {
Ok(number) => port = Some(number),
Err(error) => {
debug!("{error} for arg2: {arg2}, using url argument");
argument = Some(arg2);
}
};
} else {
debug!("Missing port in legacy entry: {debug_entry:?}");
};
};

Expand Down

0 comments on commit bd9565a

Please sign in to comment.