Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make status port configurable via command line args #380

Merged
merged 4 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var (
inMemoryMode bool
tableSize int64
requestUUID string
statusPort uint

// Config is the populated *configuration.Configuration from
// the configurationFile. If none is provided, this is set
Expand Down Expand Up @@ -288,6 +289,13 @@ default values.`,
"requestUUID configures the requestUUID in logs, which aims to enable search logs by requestUUID",
)

checkDataCmd.Flags().UintVar(
&statusPort,
"status-port",
0,
"status-port configures the status query port, this will override the status_port",
)

rootCmd.AddCommand(checkDataCmd)
checkConstructionCmd.Flags().StringVar(
&asserterConfigurationFile,
Expand Down Expand Up @@ -324,6 +332,13 @@ default values.`,
"requestUUID configures the requestUUID in logs, which aims to enable search logs by requestUUID",
)

checkConstructionCmd.Flags().UintVar(
&statusPort,
"status-port",
0,
"status-port configures the status query port, this will override the status_port",
)

rootCmd.AddCommand(checkConstructionCmd)

// View Commands
Expand Down Expand Up @@ -419,6 +434,13 @@ func initConfig() {
if len(requestUUID) != 0 {
Config.RequestUUID = requestUUID
}

if statusPort > 0 {
Config.Data.StatusPort = statusPort
if Config.Construction != nil {
Config.Construction.StatusPort = statusPort
}
}
}

func ensureDataDirectoryExists() {
Expand Down
3 changes: 1 addition & 2 deletions configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ func DefaultPerfConfiguration() *CheckPerfConfiguration {
}

// DefaultConfiguration returns a *Configuration with the
// EthereumNetwork, DefaultURL, DefaultTimeout,
// DefaultConstructionConfiguration and DefaultDataConfiguration.
// EthereumNetwork, DefaultURL, DefaultTimeout, and DefaultDataConfiguration.
func DefaultConfiguration() *Configuration {
return &Configuration{
Network: EthereumNetwork,
Expand Down