diff --git a/testing-framework/configs/src/topology/configs/api.rs b/testing-framework/configs/src/topology/configs/api.rs index 7226ca4..aaa97be 100644 --- a/testing-framework/configs/src/topology/configs/api.rs +++ b/testing-framework/configs/src/topology/configs/api.rs @@ -3,6 +3,8 @@ use std::net::SocketAddr; use nomos_utils::net::get_available_tcp_port; use thiserror::Error; +const LOCALHOST: [u8; 4] = [127, 0, 0, 1]; + #[derive(Clone)] pub struct GeneralApiConfig { pub address: SocketAddr, @@ -23,8 +25,8 @@ pub fn create_api_configs(ids: &[[u8; 32]]) -> Result, Api let testing_port = get_available_tcp_port().ok_or(ApiConfigError::PortAllocationFailed)?; Ok(GeneralApiConfig { - address: format!("127.0.0.1:{address_port}").parse().unwrap(), - testing_http_address: format!("127.0.0.1:{testing_port}").parse().unwrap(), + address: SocketAddr::from((LOCALHOST, address_port)), + testing_http_address: SocketAddr::from((LOCALHOST, testing_port)), }) }) .collect()