Skip to main content

parse_cli_args

Function parse_cli_args 

Source
pub fn parse_cli_args() -> Result<Config, Box<dyn Error>>
Expand description

Parses command-line arguments and environment variables into a Config.

The following environment variables are inspected:

  • JETSTREAMER_CLICKHOUSE_MODE: Controls ClickHouse integration. Accepts auto, remote, local, or off.
  • JETSTREAMER_THREADS: Number of firehose ingestion threads.
  • JETSTREAMER_SEQUENTIAL: Enables single-thread sequential firehose mode when truthy.
  • JETSTREAMER_REVERSE: Enables reverse epoch iteration when truthy. Implies sequential mode.
  • JETSTREAMER_BUFFER_WINDOW: Optional ripget sequential window size (for example 4GiB).

CLI flags:

  • --with-plugin <name>: Adds one of the built-in plugins (program-tracking, instruction-tracking, or pubkey-stats). When omitted, the CLI defaults to program-tracking.
  • --no-plugins: Disables all built-in plugins (overrides the default and any --with-plugin).
  • --sequential: Enables single-thread sequential firehose mode.
  • --reverse: Streams epochs from highest to lowest. Implies --sequential.
  • --buffer-window <size>: Overrides ripget sequential window size (for example 4GiB).

ยงExamples

let config = parse_cli_args().expect("env and CLI parsed");
assert_eq!(config.threads, 3);
assert!(!config.clickhouse_enabled);