Skip to content

Commit

Permalink
configurable me port
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay111meher committed Nov 12, 2024
1 parent b39fc76 commit 6f885cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions matching_engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u16>) -> Self {
Self {
config,
matching_engine_port: 3000,
matching_engine_port: matching_engine_port.unwrap_or(3000),
}
}

Expand All @@ -133,6 +133,7 @@ impl MatchingEngine {
generator_registry: String,
entity_registry: String,
start_block: String,
matching_engine_port: Option<u16>,
) -> Self {
let config: MatchingEngineConfig = MatchingEngineConfig {
rpc_url,
Expand All @@ -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<()> {
Expand Down
2 changes: 1 addition & 1 deletion matching_engine/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.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(())
Expand Down

0 comments on commit 6f885cb

Please sign in to comment.