pub use crate::{
config::{
auth::{AuthenticationConfig, AuthenticationStrategy},
client::FuelClientConfig,
database::DatabaseConfig,
limit::RateLimitConfig,
web::WebApiConfig,
},
defaults,
};
pub use clap::{Args, Parser, ValueEnum};
use std::path::PathBuf;
#[derive(Debug, Parser, Clone)]
#[clap(
name = "Indexer Service",
about = "Standalone binary for the Fuel indexer service",
version
)]
pub struct IndexerArgs {
#[clap(long, default_value = defaults::LOG_LEVEL, value_parser(["info", "debug", "error", "warn"]), help = "Log level passed to the Fuel Indexer service.")]
pub log_level: String,
#[clap(
short,
long,
value_name = "FILE",
help = "Indexer service config file."
)]
pub config: Option<PathBuf>,
#[clap(short, long, value_name = "FILE", help = "Indexer config file.")]
pub manifest: Option<PathBuf>,
#[clap(
long,
help = "Host of the running Fuel node.",
default_value = defaults::FUEL_NODE_HOST
)]
pub fuel_node_host: String,
#[clap(
long,
help = "Listening port of the running Fuel node.",
default_value = defaults::FUEL_NODE_PORT
)]
pub fuel_node_port: String,
#[clap(long, help = "Web API host.", default_value = defaults::WEB_API_HOST)]
pub web_api_host: String,
#[clap(long, help = "Web API port.", default_value = defaults::WEB_API_PORT)]
pub web_api_port: String,
#[clap(long, help = "Database type.", default_value = defaults::DATABASE, value_parser(["postgres"]))]
pub database: String,
#[clap(long, help = "Max body size for web API requests.", default_value_t = defaults::MAX_BODY_SIZE )]
pub max_body_size: usize,
#[clap(long, help = "Postgres username.")]
pub postgres_user: Option<String>,
#[clap(long, help = "Postgres database.")]
pub postgres_database: Option<String>,
#[clap(long, help = "Postgres password.")]
pub postgres_password: Option<String>,
#[clap(long, help = "Postgres host.")]
pub postgres_host: Option<String>,
#[clap(long, help = "Postgres port.")]
pub postgres_port: Option<String>,
#[clap(long, help = "Run database migrations before starting service.")]
pub run_migrations: bool,
#[clap(long, help = "Use Prometheus metrics reporting.")]
pub metrics: bool,
#[clap(
long,
help = "Prevent indexers from running without handling any blocks."
)]
pub stop_idle_indexers: bool,
#[clap(
long,
help = "Automatically create and start database using provided options or defaults."
)]
pub embedded_database: bool,
#[clap(long, help = "Require users to authenticate for some operations.")]
pub auth_enabled: bool,
#[clap(long, help = "Authentication scheme used.")]
pub auth_strategy: Option<String>,
#[clap(
long,
help = "Secret used for JWT scheme (if JWT scheme is specified)."
)]
pub jwt_secret: Option<String>,
#[clap(long, help = "Issuer of JWT claims (if JWT scheme is specified).")]
pub jwt_issuer: Option<String>,
#[clap(
long,
help = "Amount of time (seconds) before expiring token (if JWT scheme is specified)."
)]
pub jwt_expiry: Option<usize>,
#[clap(short, long, help = "Enable verbose logging.")]
pub verbose: bool,
#[clap(long, help = "Start a local Fuel node.")]
pub local_fuel_node: bool,
#[clap(long, help = "Allow network configuration via indexer manifests.")]
pub indexer_net_config: bool,
#[clap(long, help = "Enable rate limiting.")]
pub rate_limit: bool,
#[clap(
long,
help = "Maximum number of requests to allow over --rate-limit-window.."
)]
pub rate_limit_request_count: Option<u64>,
#[clap(long, help = "Number of seconds over which to allow --rate-limit-rps.")]
pub rate_limit_window_size: Option<u64>,
#[clap(
long,
help = "The number of WASM opcodes after which the indexer's event handler will stop execution.",
default_value_t = defaults::METERING_POINTS
)]
pub metering_points: u64,
#[clap(
long,
help = "Whether to allow replacing an existing indexer. If not specified, an attempt to deploy over an existing indexer results in an error."
)]
pub replace_indexer: bool,
#[clap(long, help = "Allow the web API to accept raw SQL queries.")]
pub accept_sql_queries: bool,
#[clap(long, help = "Amount of blocks to return in a request to a Fuel node.", default_value_t = defaults::NODE_BLOCK_PAGE_SIZE)]
pub block_page_size: usize,
}
#[derive(Debug, Parser, Clone)]
#[clap(
name = "Fuel Indexer API Server",
about = "Fuel indexer web API",
version
)]
pub struct ApiServerArgs {
#[clap(long, default_value = defaults::LOG_LEVEL, value_parser(["info", "debug", "error", "warn"]), help = "Log level passed to the Fuel Indexer service.")]
pub log_level: String,
#[clap(short, long, help = "API server config file.")]
pub config: Option<PathBuf>,
#[clap(
long,
help = "Host of the running Fuel node.",
default_value = defaults::FUEL_NODE_HOST
)]
pub fuel_node_host: String,
#[clap(
long,
help = "Listening port of the running Fuel node.",
default_value = defaults::FUEL_NODE_PORT
)]
pub fuel_node_port: String,
#[clap(long, help = "Web API host.", default_value = defaults::WEB_API_HOST)]
pub web_api_host: String,
#[clap(long, help = "Web API port.", default_value = defaults::WEB_API_PORT)]
pub web_api_port: String,
#[clap(long, help = "Database type.", default_value = defaults::DATABASE, value_parser(["postgres"]))]
pub database: String,
#[clap(long, help = "Max body size for web requests.", default_value_t = defaults::MAX_BODY_SIZE )]
pub max_body_size: usize,
#[clap(long, help = "Run database migrations before starting service.")]
pub run_migrations: bool,
#[clap(long, help = "Postgres username.")]
pub postgres_user: Option<String>,
#[clap(long, help = "Postgres database.")]
pub postgres_database: Option<String>,
#[clap(long, help = "Postgres password.")]
pub postgres_password: Option<String>,
#[clap(long, help = "Postgres host.")]
pub postgres_host: Option<String>,
#[clap(long, help = "Postgres port.")]
pub postgres_port: Option<String>,
#[clap(long, help = "Use Prometheus metrics reporting.")]
pub metrics: bool,
#[clap(long, help = "Require users to authenticate for some operations.")]
pub auth_enabled: bool,
#[clap(long, help = "Authentication scheme used.", value_parser(["jwt"]))]
pub auth_strategy: Option<String>,
#[clap(
long,
help = "Secret used for JWT scheme (if JWT scheme is specified)."
)]
pub jwt_secret: Option<String>,
#[clap(long, help = "Issuer of JWT claims (if JWT scheme is specified).")]
pub jwt_issuer: Option<String>,
#[clap(
long,
help = "Amount of time (seconds) before expiring token (if JWT scheme is specified)."
)]
pub jwt_expiry: Option<usize>,
#[clap(short, long, help = "Enable verbose logging.")]
pub verbose: bool,
#[clap(long, help = "Enable rate limiting.")]
pub rate_limit: bool,
#[clap(
long,
help = "Maximum number of requests to allow over --rate-limit-window.."
)]
pub rate_limit_request_count: Option<u64>,
#[clap(long, help = "Number of seconds over which to allow --rate-limit-rps.")]
pub rate_limit_window_size: Option<u64>,
#[clap(long, help = "Allow the web API to accept raw SQL queries.")]
pub accept_sql_queries: bool,
}