From 6f885cb09f83c93dcb4a2cea72bd3dee80c93e69 Mon Sep 17 00:00:00 2001 From: Akshay Date: Tue, 12 Nov 2024 15:15:50 +0000 Subject: [PATCH] configurable me port --- matching_engine/src/lib.rs | 7 ++++--- matching_engine/src/main.rs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/matching_engine/src/lib.rs b/matching_engine/src/lib.rs index bf0d9a4..0722ba9 100644 --- a/matching_engine/src/lib.rs +++ b/matching_engine/src/lib.rs @@ -116,10 +116,10 @@ pub struct MatchingEngine { } impl MatchingEngine { - pub fn from_config(config: MatchingEngineConfig) -> Self { + pub fn from_config(config: MatchingEngineConfig, matching_engine_port: Option) -> Self { Self { config, - matching_engine_port: 3000, + matching_engine_port: matching_engine_port.unwrap_or(3000), } } @@ -133,6 +133,7 @@ impl MatchingEngine { generator_registry: String, entity_registry: String, start_block: String, + matching_engine_port: Option, ) -> Self { let config: MatchingEngineConfig = MatchingEngineConfig { rpc_url, @@ -145,7 +146,7 @@ impl MatchingEngine { start_block, }; - Self::from_config(config) + Self::from_config(config, matching_engine_port) } pub async fn run(&self) -> anyhow::Result<()> { diff --git a/matching_engine/src/main.rs b/matching_engine/src/main.rs index 758a753..9ad7635 100644 --- a/matching_engine/src/main.rs +++ b/matching_engine/src/main.rs @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { .or_else(|_| fs::read_to_string(&alt_matching_engine_config_path))?; let config: MatchingEngineConfig = serde_json::from_str(&file_content)?; - let matching_engine = MatchingEngine::from_config(config); + let matching_engine = MatchingEngine::from_config(config, None); let _ = matching_engine.run().await; Ok(())