-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplifying BesuCommand step 1 (#7682)
Simplifying BesuCommand --------- Signed-off-by: Justin Florentine <justin+github@florentine.us>
- Loading branch information
Showing
19 changed files
with
501 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
305 changes: 54 additions & 251 deletions
305
besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
besu/src/main/java/org/hyperledger/besu/cli/options/stable/EngineRPCConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.cli.options.stable; | ||
|
||
import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty; | ||
|
||
import java.nio.file.Path; | ||
|
||
/** | ||
* Command line options for configuring Engine RPC on the node. | ||
* | ||
* @param overrideEngineRpcEnabled enable the engine api, even in the absence of merge-specific | ||
* configurations. | ||
* @param engineRpcPort Port to provide consensus client APIS on | ||
* @param engineJwtKeyFile Path to file containing shared secret key for JWT signature verification | ||
* @param isEngineAuthDisabled Disable authentication for Engine APIs | ||
* @param engineHostsAllowlist List of hosts to allowlist for Engine APIs | ||
*/ | ||
public record EngineRPCConfiguration( | ||
Boolean overrideEngineRpcEnabled, | ||
Integer engineRpcPort, | ||
Path engineJwtKeyFile, | ||
Boolean isEngineAuthDisabled, | ||
JsonRPCAllowlistHostsProperty engineHostsAllowlist) {} |
81 changes: 81 additions & 0 deletions
81
besu/src/main/java/org/hyperledger/besu/cli/options/stable/EngineRPCOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.cli.options.stable; | ||
|
||
import static org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration.DEFAULT_ENGINE_JSON_RPC_PORT; | ||
|
||
import org.hyperledger.besu.cli.DefaultCommandValues; | ||
import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty; | ||
import org.hyperledger.besu.cli.options.CLIOptions; | ||
import org.hyperledger.besu.cli.util.CommandLineUtils; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
|
||
import picocli.CommandLine; | ||
|
||
/** Command line options for configuring Engine RPC on the node. */ | ||
public class EngineRPCOptions implements CLIOptions<EngineRPCConfiguration> { | ||
|
||
/** Default constructor */ | ||
public EngineRPCOptions() {} | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-rpc-enabled"}, | ||
description = "enable the engine api, even in the absence of merge-specific configurations.") | ||
private final Boolean overrideEngineRpcEnabled = false; | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-rpc-port", "--engine-rpc-http-port"}, | ||
paramLabel = DefaultCommandValues.MANDATORY_PORT_FORMAT_HELP, | ||
description = "Port to provide consensus client APIS on (default: ${DEFAULT-VALUE})", | ||
arity = "1") | ||
private final Integer engineRpcPort = DEFAULT_ENGINE_JSON_RPC_PORT; | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-jwt-secret"}, | ||
paramLabel = DefaultCommandValues.MANDATORY_FILE_FORMAT_HELP, | ||
description = "Path to file containing shared secret key for JWT signature verification") | ||
private final Path engineJwtKeyFile = null; | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-jwt-disabled"}, | ||
description = "Disable authentication for Engine APIs (default: ${DEFAULT-VALUE})") | ||
private final Boolean isEngineAuthDisabled = false; | ||
|
||
@CommandLine.Option( | ||
names = {"--engine-host-allowlist"}, | ||
paramLabel = "<hostname>[,<hostname>...]... or * or all", | ||
description = | ||
"Comma separated list of hostnames to allow for ENGINE API access (applies to both HTTP and websockets), or * to accept any host (default: ${DEFAULT-VALUE})", | ||
defaultValue = "localhost,127.0.0.1") | ||
private final JsonRPCAllowlistHostsProperty engineHostsAllowlist = | ||
new JsonRPCAllowlistHostsProperty(); | ||
|
||
@Override | ||
public EngineRPCConfiguration toDomainObject() { | ||
return new EngineRPCConfiguration( | ||
overrideEngineRpcEnabled, | ||
engineRpcPort, | ||
engineJwtKeyFile, | ||
isEngineAuthDisabled, | ||
engineHostsAllowlist); | ||
} | ||
|
||
@Override | ||
public List<String> getCLIOptions() { | ||
return CommandLineUtils.getCLIOptions(this, new EngineRPCOptions()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.