Skip to content

Commit

Permalink
fix(config): fix http port argument (#1751)
Browse files Browse the repository at this point in the history
  • Loading branch information
gurinderu committed Aug 11, 2023
1 parent f85489b commit 84c4315
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/server-config/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ pub(crate) struct DerivedArgs {
#[arg(
short('s'),
long,
id = "METRICS_PORT",
help = "open metrics port",
id = "HTTP_PORT",
help = "http port",
help_heading = "Networking",
display_order = 3
)]
metrics_port: Option<u16>,
http_port: Option<u16>,
#[arg(
short('x'),
long("external-ip"),
Expand Down
27 changes: 27 additions & 0 deletions crates/server-config/src/resolved_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,4 +685,31 @@ mod tests {
);
});
}

#[test]
fn load_http_port_with_env() {
temp_env::with_vars([("FLUENCE_HTTP_PORT", Some("1234"))], || {
let config = load_config_with_args(vec![], None).expect("Could not load config");
assert_eq!(
config.node_config.http_config.map(|x| x.http_port),
Some(1234)
);
});
}

#[test]
fn load_http_port_with_args() {
temp_env::with_vars([("FLUENCE_HTTP_PORT", Some("1234"))], || {
let args = vec![
OsString::from("nox"),
OsString::from("--http-port"),
OsString::from("1001"),
];
let config = load_config_with_args(args, None).expect("Could not load config");
assert_eq!(
config.node_config.http_config.map(|x| x.http_port),
Some(1001)
);
});
}
}

0 comments on commit 84c4315

Please sign in to comment.