Skip to content

Commit

Permalink
Remove unused port update functions
Browse files Browse the repository at this point in the history
  • Loading branch information
matias-gonz committed Sep 27, 2024
1 parent 796f1ea commit 2810ff1
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions zk_toolbox/crates/config/src/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use anyhow::Context;
use common::yaml::merge_yaml;
use url::Url;
use xshell::Shell;
use zksync_config::configs::object_store::ObjectStoreMode;
pub use zksync_config::configs::GeneralConfig;
use zksync_config::configs::{consensus::Host, object_store::ObjectStoreMode};
use zksync_protobuf_config::{decode_yaml_repr, encode_yaml_repr};

use crate::{
Expand Down Expand Up @@ -122,22 +122,6 @@ pub fn override_config(shell: &Shell, path: PathBuf, chain: &ChainConfig) -> any
Ok(())
}

pub fn update_port_in_url(http_url: &mut String, port: u16) -> anyhow::Result<()> {
let mut http_url_url = Url::parse(http_url)?;
if let Err(()) = http_url_url.set_port(Some(port)) {
anyhow::bail!("Wrong url, setting port is impossible");
}
*http_url = http_url_url.to_string();
Ok(())
}

pub fn update_port_in_host(host: &mut Host, port: u16) -> anyhow::Result<()> {
let url = Url::parse(&format!("http://{}", host.0))?;
let host_str = url.host_str().context("Failed to get host")?;
host.0 = format!("{host_str}:{port}");
Ok(())
}

impl FileConfigWithDefaultName for GeneralConfig {
const FILE_NAME: &'static str = GENERAL_FILE;
}
Expand Down

0 comments on commit 2810ff1

Please sign in to comment.