Skip to content

Commit fb7ae05

Browse files
committed
Listen to a specific port
1 parent 05ea801 commit fb7ae05

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

cli.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ const packageJson = require("./package.json");
1010
function getOptions(program) {
1111
return {
1212
workdir: program.workdir || fs.mkdtempSync(`${os.tmpdir()}${sep}`),
13+
port: program.port,
1314
download: program.download,
1415
logging: program.logging,
1516
allocate: program.allocate,
1617
chainId: program.chainid,
1718
execute: program.execute,
18-
nodeArguments: program.nodeArguments
19+
nodeArguments: program.nodeArguments,
1920
};
2021
}
2122

@@ -31,6 +32,12 @@ program
3132
.version(packageJson.version)
3233
.option("-d, --download", "Download the Ethereum client and exit.")
3334
.option("-w, --workdir <dir>", "Specify a working dir.")
35+
.option(
36+
"-p, --port <port>",
37+
"Specify the JSONRPC port.",
38+
(v) => parseInt(v, 10),
39+
8545
40+
)
3441
.option("-l, --logging <level>", "Specify logging level (error, warn, info).")
3542
.option(
3643
"-c, --chainid <int>",

main.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,16 @@ async function provide(
158158

159159
async function run(
160160
client,
161-
{ download, workdir, logging, allocate, chainId, execute, nodeArguments }
161+
{
162+
download,
163+
workdir,
164+
port,
165+
logging,
166+
allocate,
167+
chainId,
168+
execute,
169+
nodeArguments,
170+
}
162171
) {
163172
const loggingOptions = logging
164173
? client === "geth"
@@ -208,16 +217,16 @@ async function run(
208217
"30311",
209218
"--http",
210219
"--http.addr",
211-
"localhost",
220+
"0.0.0.0",
212221
"--http.port",
213-
"8545",
222+
port,
214223
"--http.api",
215224
"personal,eth,net,web3,txpool,miner,debug",
216225
"--http.corsdomain",
217226
"*",
218227
"--ws",
219228
"--ws.addr",
220-
"localhost",
229+
"0.0.0.0",
221230
"--ws.port",
222231
"8546",
223232
"--ws.api",
@@ -245,6 +254,8 @@ async function run(
245254
"--no-discovery",
246255
"--db-path",
247256
paths.data,
257+
"--jsonrpc-port",
258+
port,
248259
"--chain",
249260
paths.genesis,
250261
"--keys-path",

package-lock.json

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)