Fix command line flags (#623)

This commit is contained in:
Adam Babik 2018-02-06 13:53:04 +01:00 committed by Ivan Daniluk
parent f90e65820c
commit c00e5c9c58
2 changed files with 5 additions and 15 deletions

View File

@ -46,6 +46,7 @@ var (
listenAddr = flag.String("listenaddr", ":30303", "IP address and port of this node (e.g. 127.0.0.1:30303)")
standalone = flag.Bool("standalone", true, "Don't actively connect to peers, wait for incoming connections")
bootnodes = flag.String("bootnodes", "", "A list of bootnodes separated by comma")
discovery = flag.Bool("discovery", false, "Enable discovery protocol")
// stats
statsEnabled = flag.Bool("stats", false, "Expose node stats via /debug/vars expvar endpoint or Prometheus (log by default)")
@ -169,6 +170,8 @@ func makeNodeConfig() (*params.NodeConfig, error) {
return nil, err
}
nodeConfig.ListenAddr = *listenAddr
// TODO(divan): move this logic into params package
if *nodeKeyFile != "" {
nodeConfig.NodeKeyFile = *nodeKeyFile
@ -194,10 +197,10 @@ func makeNodeConfig() (*params.NodeConfig, error) {
if *standalone {
nodeConfig.BootClusterConfig.Enabled = false
nodeConfig.BootClusterConfig.BootNodes = nil
} else {
nodeConfig.Discovery = true
}
nodeConfig.Discovery = *discovery
// Even if standalone is true and discovery is disabled,
// it's possible to use bootnodes in NodeManager.PopulateStaticPeers().
// TODO(adam): research if we need NodeManager.PopulateStaticPeers() at all.

View File

@ -11,12 +11,6 @@ import (
// whisperConfig creates node configuration object from flags
func whisperConfig(nodeConfig *params.NodeConfig) (*params.NodeConfig, error) {
nodeConfig.ListenAddr = *listenAddr
nodeConfig.LogLevel = *logLevel
// whisper configuration
whisperConfig := nodeConfig.WhisperConfig
whisperConfig.Enabled = true
whisperConfig.IdentityFile = *identityFile
@ -57,13 +51,6 @@ func whisperConfig(nodeConfig *params.NodeConfig) (*params.NodeConfig, error) {
}
}
// RPC configuration
// TODO(adam): clarify all these IPC/RPC/HTTPHost
if !*httpEnabled {
nodeConfig.HTTPHost = "" // HTTP RPC is disabled
}
nodeConfig.HTTPHost = "0.0.0.0"
return nodeConfig, nil
}