Skip to content

Commit

Permalink
feat(antctl): impl network_id option while adding node
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin committed Dec 9, 2024
1 parent c3e3fa8 commit aae44cb
Show file tree
Hide file tree
Showing 10 changed files with 447 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ant-node-manager/src/add_services/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub struct InstallNodeServiceCtxBuilder {
pub log_dir_path: PathBuf,
pub log_format: Option<LogFormat>,
pub name: String,
pub network_id: Option<u8>,
pub max_archived_log_files: Option<usize>,
pub max_log_files: Option<usize>,
pub metrics_port: Option<u16>,
Expand All @@ -105,6 +106,10 @@ impl InstallNodeServiceCtxBuilder {
];

push_arguments_from_peers_args(&self.peers_args, &mut args);
if let Some(id) = self.network_id {
args.push(OsString::from("--network-id"));
args.push(OsString::from(id.to_string()));
}
if self.home_network {
args.push(OsString::from("--home-network"));
}
Expand Down Expand Up @@ -185,6 +190,7 @@ pub struct AddNodeServiceOptions {
pub max_archived_log_files: Option<usize>,
pub max_log_files: Option<usize>,
pub metrics_port: Option<PortRange>,
pub network_id: Option<u8>,
pub node_ip: Option<Ipv4Addr>,
pub node_port: Option<PortRange>,
pub owner: Option<String>,
Expand Down Expand Up @@ -314,10 +320,11 @@ mod tests {
home_network: false,
log_dir_path: PathBuf::from("/logs"),
log_format: None,
name: "test-node".to_string(),
max_archived_log_files: None,
max_log_files: None,
metrics_port: None,
name: "test-node".to_string(),
network_id: None,
node_ip: None,
node_port: None,
owner: None,
Expand Down Expand Up @@ -349,10 +356,11 @@ mod tests {
home_network: false,
log_dir_path: PathBuf::from("/logs"),
log_format: None,
name: "test-node".to_string(),
max_archived_log_files: None,
max_log_files: None,
metrics_port: None,
name: "test-node".to_string(),
network_id: None,
node_ip: None,
node_port: None,
owner: None,
Expand Down Expand Up @@ -385,10 +393,11 @@ mod tests {
home_network: false,
log_dir_path: PathBuf::from("/logs"),
log_format: None,
name: "test-node".to_string(),
max_archived_log_files: Some(10),
max_log_files: Some(10),
metrics_port: None,
name: "test-node".to_string(),
network_id: Some(5),
node_ip: None,
node_port: None,
owner: None,
Expand Down Expand Up @@ -510,6 +519,8 @@ mod tests {
"http://localhost:8080",
"--testnet",
"--ignore-cache",
"--network-id",
"5",
"--home-network",
"--log-format",
"json",
Expand Down
2 changes: 2 additions & 0 deletions ant-node-manager/src/add_services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ pub async fn add_node(
max_log_files: options.max_log_files,
metrics_port: metrics_free_port,
name: service_name.clone(),
network_id: options.network_id,
node_ip: options.node_ip,
node_port,
owner: owner.clone(),
Expand Down Expand Up @@ -246,6 +247,7 @@ pub async fn add_node(
max_archived_log_files: options.max_archived_log_files,
max_log_files: options.max_log_files,
metrics_port: metrics_free_port,
network_id: options.network_id,
node_ip: options.node_ip,
node_port,
number: node_number,
Expand Down
Loading

0 comments on commit aae44cb

Please sign in to comment.