From aabf6f9f6d94de8aaa68bfb742e14dc0055b2384 Mon Sep 17 00:00:00 2001 From: nadin-Starkware Date: Tue, 10 Dec 2024 15:56:49 +0200 Subject: [PATCH] chore: add get_http_server_config function commit-id:927ec671 --- crates/starknet_integration_tests/src/utils.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/starknet_integration_tests/src/utils.rs b/crates/starknet_integration_tests/src/utils.rs index e9c92d3809c..f13c2eb3716 100644 --- a/crates/starknet_integration_tests/src/utils.rs +++ b/crates/starknet_integration_tests/src/utils.rs @@ -29,6 +29,7 @@ use starknet_http_server::config::HttpServerConfig; use starknet_mempool_p2p::config::MempoolP2pConfig; use starknet_monitoring_endpoint::config::MonitoringEndpointConfig; use starknet_sequencer_infra::test_utils::get_available_socket; +use starknet_sequencer_node::config::component_execution_config::ComponentExecutionMode; use starknet_sequencer_node::config::node_config::SequencerNodeConfig; use starknet_sequencer_node::config::test_utils::RequiredParams; use starknet_types_core::felt::Felt; @@ -277,3 +278,17 @@ fn create_monitoring_endpoint_config(sequencer_index: usize) -> MonitoringEndpoi config.port += u16::try_from(sequencer_index).unwrap(); config } + +pub fn get_http_server_config(configs: &[SequencerNodeConfig]) -> Option<&HttpServerConfig> { + configs + .iter() + .find(|config| { + matches!( + config.components.http_server.execution_mode, + ComponentExecutionMode::Remote + | ComponentExecutionMode::LocalExecutionWithRemoteEnabled + | ComponentExecutionMode::LocalExecutionWithRemoteDisabled + ) + }) + .map(|config| &config.http_server_config) +}