Skip to content

Commit

Permalink
Cleanup confusingly duplicate names
Browse files Browse the repository at this point in the history
  • Loading branch information
sasa-tomic committed Apr 5, 2024
1 parent 28b06aa commit 5c26711
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion rs/cli/src/clients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl DashboardBackendClient {
}
}

pub fn new_with_network_url(url: String) -> Self {
pub fn new_with_backend_url(url: String) -> Self {
Self {
url: reqwest::Url::parse(&url).unwrap(),
}
Expand Down
4 changes: 2 additions & 2 deletions rs/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ async fn main() -> Result<(), anyhow::Error> {
let runner_unauth = || async {
let cli = cli::ParsedCli::from_opts(&cli_opts, false).await.expect("Failed to create unauthenticated CLI");
let ic_admin_wrapper = IcAdminWrapper::from_cli(cli);
runner::Runner::new_with_network_url(ic_admin_wrapper, backend_port).await.expect("Failed to create unauthenticated runner")
runner::Runner::new_with_network_and_backend_port(ic_admin_wrapper, &target_network, backend_port).await.expect("Failed to create unauthenticated runner")
};

let runner_auth = || async {
let cli = cli::ParsedCli::from_opts(&cli_opts, true).await.expect("Failed to create authenticated CLI");
let ic_admin_wrapper = IcAdminWrapper::from_cli(cli);
runner::Runner::new_with_network_url(ic_admin_wrapper, backend_port).await.expect("Failed to create authenticated runner")
runner::Runner::new_with_network_and_backend_port(ic_admin_wrapper, &target_network, backend_port).await.expect("Failed to create authenticated runner")
};

match &cli_opts.subcommand {
Expand Down
13 changes: 7 additions & 6 deletions rs/cli/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,14 @@ impl Runner {
Ok(())
}

pub async fn new_with_network_url(ic_admin: ic_admin::IcAdminWrapper, backend_port: u16) -> anyhow::Result<Self> {
pub async fn new_with_network_and_backend_port(
ic_admin: ic_admin::IcAdminWrapper,
network: &Network,
backend_port: u16,
) -> anyhow::Result<Self> {
let backend_url = format!("http://localhost:{}/", backend_port);
let network = Network::new("localhost", &vec![backend_url.parse()?])
.await
.map_err(|e| anyhow::format_err!("{}", e))?;

let dashboard_backend_client = DashboardBackendClient::new_with_network_url(backend_url);
let dashboard_backend_client = DashboardBackendClient::new_with_backend_url(backend_url);
Ok(Self {
ic_admin,
dashboard_backend_client,
Expand All @@ -201,7 +202,7 @@ impl Runner {
// TODO: Remove once DREL-118 completed.
let backend_port = local_unused_port();
let backend_url = format!("http://localhost:{}/", backend_port);
let dashboard_backend_client = DashboardBackendClient::new_with_network_url(backend_url);
let dashboard_backend_client = DashboardBackendClient::new_with_backend_url(backend_url);

let mut registry = registry::RegistryState::new(network, true).await;
let node_providers = query_ic_dashboard_list::<NodeProvidersResponse>("v3/node-providers")
Expand Down

0 comments on commit 5c26711

Please sign in to comment.