Skip to main content

iota_graphql_rpc/
commands.rs

1// Copyright (c) Mysten Labs, Inc.
2// Modifications Copyright (c) 2024 IOTA Stiftung
3// SPDX-License-Identifier: Apache-2.0
4
5use std::path::PathBuf;
6
7use clap::*;
8
9use crate::config::{ConnectionConfig, HistoricFallbackOptions, Ide, TxExecFullNodeConfig};
10
11#[derive(Parser)]
12#[command(name = "iota-graphql-rpc", about = "IOTA GraphQL RPC", author)]
13pub enum Command {
14    /// Output a TOML config (suitable for passing into the --config parameter
15    /// of the start-server command) with all values set to their defaults.
16    GenerateConfig {
17        /// Optional path to an output file. Prints to `stdout` if not provided.
18        output: Option<PathBuf>,
19    },
20    GenerateSchema {
21        /// Path to output GraphQL schema to, in SDL format.
22        #[arg(short, long)]
23        file: Option<PathBuf>,
24    },
25    StartServer {
26        #[command(flatten)]
27        ide: Ide,
28
29        #[command(flatten)]
30        connection: ConnectionConfig,
31
32        #[command(flatten)]
33        historic_fallback: Box<HistoricFallbackOptions>,
34
35        /// Path to TOML file containing configuration for service.
36        #[arg(short, long)]
37        config: Option<PathBuf>,
38
39        #[command(flatten)]
40        tx_exec_full_node: TxExecFullNodeConfig,
41    },
42}