Skip to content

Commit e95a8c3

Browse files
authored
Merge pull request #380 from coinbase/expose-status-port
Make status port configurable via command line args
2 parents 0b38f55 + 4a1468e commit e95a8c3

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

cmd/root.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ var (
5858
inMemoryMode bool
5959
tableSize int64
6060
requestUUID string
61+
statusPort uint
6162

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

292+
checkDataCmd.Flags().UintVar(
293+
&statusPort,
294+
"status-port",
295+
0,
296+
"status-port configures the status query port, this will override the status_port",
297+
)
298+
291299
rootCmd.AddCommand(checkDataCmd)
292300
checkConstructionCmd.Flags().StringVar(
293301
&asserterConfigurationFile,
@@ -324,6 +332,13 @@ default values.`,
324332
"requestUUID configures the requestUUID in logs, which aims to enable search logs by requestUUID",
325333
)
326334

335+
checkConstructionCmd.Flags().UintVar(
336+
&statusPort,
337+
"status-port",
338+
0,
339+
"status-port configures the status query port, this will override the status_port",
340+
)
341+
327342
rootCmd.AddCommand(checkConstructionCmd)
328343

329344
// View Commands
@@ -419,6 +434,13 @@ func initConfig() {
419434
if len(requestUUID) != 0 {
420435
Config.RequestUUID = requestUUID
421436
}
437+
438+
if statusPort > 0 {
439+
Config.Data.StatusPort = statusPort
440+
if Config.Construction != nil {
441+
Config.Construction.StatusPort = statusPort
442+
}
443+
}
422444
}
423445

424446
func ensureDataDirectoryExists() {

configuration/configuration.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ func DefaultPerfConfiguration() *CheckPerfConfiguration {
5757
}
5858

5959
// DefaultConfiguration returns a *Configuration with the
60-
// EthereumNetwork, DefaultURL, DefaultTimeout,
61-
// DefaultConstructionConfiguration and DefaultDataConfiguration.
60+
// EthereumNetwork, DefaultURL, DefaultTimeout, and DefaultDataConfiguration.
6261
func DefaultConfiguration() *Configuration {
6362
return &Configuration{
6463
Network: EthereumNetwork,

0 commit comments

Comments
 (0)