Skip to content

Commit

Permalink
Merge pull request #380 from coinbase/expose-status-port
Browse files Browse the repository at this point in the history
Make status port configurable via command line args
  • Loading branch information
xiaying-peng committed Dec 12, 2022
2 parents 0b38f55 + 4a1468e commit e95a8c3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
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

0 comments on commit e95a8c3

Please sign in to comment.