sui_indexer_alt_jsonrpc/
args.rs

1// Copyright (c) Mysten Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4use std::path::PathBuf;
5
6use sui_indexer_alt_metrics::MetricsArgs;
7use sui_indexer_alt_reader::consistent_reader::ConsistentReaderArgs;
8use sui_indexer_alt_reader::kv_loader::KvArgs;
9use sui_indexer_alt_reader::pg_reader::db::DbArgs;
10use url::Url;
11
12use crate::NodeArgs;
13use crate::RpcArgs;
14
15pub use sui_indexer_alt_reader::system_package_task::SystemPackageTaskArgs;
16
17#[derive(clap::Parser, Debug, Clone)]
18pub struct Args {
19    #[command(subcommand)]
20    pub command: Command,
21}
22
23#[allow(clippy::large_enum_variant)]
24#[derive(clap::Subcommand, Debug, Clone)]
25pub enum Command {
26    /// Run the RPC service.
27    Rpc {
28        /// The URL of the database to connect to.
29        #[clap(
30            long,
31            default_value = "postgres://postgres:postgrespw@localhost:5432/sui_indexer_alt"
32        )]
33        database_url: Url,
34
35        #[command(flatten)]
36        db_args: DbArgs,
37
38        #[command(flatten)]
39        kv_args: KvArgs,
40
41        #[command(flatten)]
42        consistent_reader_args: ConsistentReaderArgs,
43
44        #[command(flatten)]
45        rpc_args: RpcArgs,
46
47        #[command(flatten)]
48        system_package_task_args: SystemPackageTaskArgs,
49
50        #[command(flatten)]
51        metrics_args: MetricsArgs,
52
53        #[command(flatten)]
54        node_args: NodeArgs,
55
56        /// Path to the RPC's configuration TOML file. If one is not provided, the default values for
57        /// the configuration will be set.
58        #[arg(long)]
59        config: Option<PathBuf>,
60    },
61
62    /// Output the contents of the default configuration to STDOUT.
63    GenerateConfig,
64}