Skip to content

Commit e2d382f

Browse files
authored
feat: add --addr flag to batcher (#1708)
1 parent 306f72d commit e2d382f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

batcher/aligned-batcher/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ struct Cli {
2424
env_file: Option<String>,
2525
#[arg(short, long)]
2626
port: Option<u16>,
27+
#[arg(short, long)]
28+
addr: Option<String>,
2729
}
2830

2931
#[tokio::main]
3032
async fn main() -> Result<(), BatcherError> {
3133
let cli = Cli::parse();
3234
let port = cli.port.unwrap_or(8080);
35+
let addr = cli.addr.unwrap_or("localhost".to_string());
3336

3437
match cli.env_file {
3538
Some(env_file) => dotenvy::from_filename(env_file).ok(),
@@ -40,7 +43,7 @@ async fn main() -> Result<(), BatcherError> {
4043
let batcher = Batcher::new(cli.config).await;
4144
let batcher = Arc::new(batcher);
4245

43-
let addr = format!("localhost:{}", port);
46+
let address = format!("{addr}:{port}");
4447

4548
// spawn task to listening for incoming blocks
4649
tokio::spawn({
@@ -54,7 +57,7 @@ async fn main() -> Result<(), BatcherError> {
5457

5558
batcher.metrics.inc_batcher_restart();
5659

57-
batcher.listen_connections(&addr).await?;
60+
batcher.listen_connections(&address).await?;
5861

5962
Ok(())
6063
}

0 commit comments

Comments
 (0)