Skip to content

Commit bdec95e

Browse files
committed
node/gnd: Make ports configurable
1 parent 8f706cf commit bdec95e

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

node/src/bin/dev.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,35 @@ pub struct DevOpt {
9090
default_value = "https://api.thegraph.com/ipfs"
9191
)]
9292
pub ipfs: Vec<String>,
93+
#[clap(
94+
long,
95+
default_value = "8000",
96+
value_name = "PORT",
97+
help = "Port for the GraphQL HTTP server",
98+
env = "GRAPH_GRAPHQL_HTTP_PORT"
99+
)]
100+
pub http_port: u16,
101+
#[clap(
102+
long,
103+
default_value = "8030",
104+
value_name = "PORT",
105+
help = "Port for the index node server"
106+
)]
107+
pub index_node_port: u16,
108+
#[clap(
109+
long,
110+
default_value = "8020",
111+
value_name = "PORT",
112+
help = "Port for the JSON-RPC admin server"
113+
)]
114+
pub admin_port: u16,
115+
#[clap(
116+
long,
117+
default_value = "8040",
118+
value_name = "PORT",
119+
help = "Port for the Prometheus metrics server"
120+
)]
121+
pub metrics_port: u16,
93122
}
94123

95124
/// Builds the Graph Node options from DevOpt
@@ -109,7 +138,12 @@ fn build_args(dev_opt: &DevOpt, db_url: &str) -> Result<Opt> {
109138
args.push("--postgres-url".to_string());
110139
args.push(db_url.to_string());
111140

112-
let opt = Opt::parse_from(args);
141+
let mut opt = Opt::parse_from(args);
142+
143+
opt.http_port = dev_opt.http_port;
144+
opt.admin_port = dev_opt.admin_port;
145+
opt.metrics_port = dev_opt.admin_port;
146+
opt.index_node_port = dev_opt.admin_port;
113147

114148
Ok(opt)
115149
}

0 commit comments

Comments
 (0)