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
9#[derive(Parser)]
10#[command(name = "iota-graphql-rpc", about = "IOTA GraphQL RPC", author)]
11pub enum Command {
12 /// Output a TOML config (suitable for passing into the --config parameter
13 /// of the start-server command) with all values set to their defaults.
14 GenerateConfig {
15 /// Optional path to an output file. Prints to `stdout` if not provided.
16 output: Option<PathBuf>,
17 },
18 GenerateSchema {
19 /// Path to output GraphQL schema to, in SDL format.
20 #[arg(short, long)]
21 file: Option<PathBuf>,
22 },
23 StartServer {
24 /// The title to display at the top of the page
25 #[arg(short, long)]
26 ide_title: Option<String>,
27 /// DB URL for data fetching
28 #[arg(short, long)]
29 db_url: Option<String>,
30 /// Pool size for DB connections
31 #[arg(long)]
32 db_pool_size: Option<u32>,
33 /// Port to bind the server to
34 #[arg(short, long)]
35 port: Option<u16>,
36 /// Host to bind the server to
37 #[arg(long)]
38 host: Option<String>,
39 /// Port to bind the prom server to
40 #[arg(long)]
41 prom_port: Option<u16>,
42 /// Host to bind the prom server to
43 #[arg(long)]
44 prom_host: Option<String>,
45
46 /// Path to TOML file containing configuration for service.
47 #[arg(short, long)]
48 config: Option<PathBuf>,
49
50 /// RPC url to the Node for tx execution
51 #[arg(long)]
52 node_rpc_url: Option<String>,
53 },
54}