Skip to content

Commit

Permalink
refactor: rework torii CLI to be similar to katana
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Nov 10, 2024
1 parent c6bbcf5 commit e3a9d49
Show file tree
Hide file tree
Showing 7 changed files with 586 additions and 176 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion bin/katana/src/cli/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,24 @@ pub struct ServerOptions {
/// HTTP-RPC server listening interface.
#[arg(long = "http.addr", value_name = "ADDRESS")]
#[arg(default_value_t = DEFAULT_RPC_ADDR)]
#[serde(default = "default_http_addr")]
pub http_addr: IpAddr,

/// HTTP-RPC server listening port.
#[arg(long = "http.port", value_name = "PORT")]
#[arg(default_value_t = DEFAULT_RPC_PORT)]
#[serde(default = "default_http_port")]
pub http_port: u16,

/// Comma separated list of domains from which to accept cross origin requests.
#[arg(long = "http.corsdomain")]
#[arg(long = "http.cors_origins")]
#[arg(value_delimiter = ',')]
pub http_cors_origins: Option<Vec<String>>,

/// Maximum number of concurrent connections allowed.
#[arg(long = "rpc.max-connections", value_name = "COUNT")]
#[arg(default_value_t = DEFAULT_RPC_MAX_CONNECTIONS)]
#[serde(default = "default_max_connections")]
pub max_connections: u32,
}

Expand Down Expand Up @@ -272,3 +275,15 @@ fn default_validate_max_steps() -> u32 {
fn default_invoke_max_steps() -> u32 {
DEFAULT_INVOCATION_MAX_STEPS
}

fn default_http_addr() -> IpAddr {
DEFAULT_RPC_ADDR
}

Check warning on line 281 in bin/katana/src/cli/options.rs

View check run for this annotation

Codecov / codecov/patch

bin/katana/src/cli/options.rs#L279-L281

Added lines #L279 - L281 were not covered by tests

fn default_http_port() -> u16 {
DEFAULT_RPC_PORT
}

Check warning on line 285 in bin/katana/src/cli/options.rs

View check run for this annotation

Codecov / codecov/patch

bin/katana/src/cli/options.rs#L283-L285

Added lines #L283 - L285 were not covered by tests

fn default_max_connections() -> u32 {
DEFAULT_RPC_MAX_CONNECTIONS
}

Check warning on line 289 in bin/katana/src/cli/options.rs

View check run for this annotation

Codecov / codecov/patch

bin/katana/src/cli/options.rs#L287-L289

Added lines #L287 - L289 were not covered by tests
1 change: 1 addition & 0 deletions bin/torii/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ tempfile.workspace = true
clap_config = "0.1.1"

[dev-dependencies]
assert_matches.workspace = true
camino.workspace = true

[features]
Expand Down
Loading

0 comments on commit e3a9d49

Please sign in to comment.