Skip to content

Commit

Permalink
Allow passing arguments directly to Ethereum node (#21)
Browse files Browse the repository at this point in the history
* Allow passing arguments directly to Ethereum node

- Fixes #19

* Problem: Error when --nodeArguments are missing

Make sure to pass no arguments when nodeArguments value is falsy.
  • Loading branch information
TimDaub authored May 16, 2021
1 parent 16c5d63 commit f2eecb1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function getOptions(program) {
allocate: program.allocate,
chainId: program.chainid,
execute: program.execute,
nodeArguments: program.nodeArguments
};
}

Expand Down Expand Up @@ -46,6 +47,10 @@ program
.option(
"-e, --execute <command>",
"Start ethnode, execute command, and exit ethnode (useful for testing)."
)
.option(
"--node-arguments <args>",
"Arguments that are passed directly to ethnode's underlying Ethereum node."
);

program.version(packageJson.version);
Expand Down
4 changes: 3 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async function provide(

async function run(
client,
{ download, workdir, logging, allocate, chainId, execute }
{ download, workdir, logging, allocate, chainId, execute, nodeArguments }
) {
const loggingOptions = logging
? client === "geth"
Expand Down Expand Up @@ -269,6 +269,8 @@ async function run(
throw `Client "${client}" is not supported`;
}

if (nodeArguments) args.push(nodeArguments);

if (logging === "debug") {
console.log("running:", paths.binary, args.join(" "));
}
Expand Down

0 comments on commit f2eecb1

Please sign in to comment.