Skip to content

Commit

Permalink
cmd, node: dump empty value config (ethereum#21296)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Nov 8, 2024
1 parent c465b3f commit 63a53f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 8 additions & 5 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,12 +768,15 @@ func setNAT(ctx *cli.Context, cfg *p2p.Config) {

// splitAndTrim splits input separated by a comma
// and trims excessive white space from the substrings.
func splitAndTrim(input string) []string {
result := strings.Split(input, ",")
for i, r := range result {
result[i] = strings.TrimSpace(r)
func splitAndTrim(input string) (ret []string) {
l := strings.Split(input, ",")
for _, r := range l {
r = strings.TrimSpace(r)
if len(r) > 0 {
ret = append(ret, r)
}
}
return result
return ret
}

// setHTTP creates the HTTP RPC listener interface string from the set
Expand Down
10 changes: 5 additions & 5 deletions node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ type Config struct {
// a simple file name, it is placed inside the data directory (or on the root
// pipe path on Windows), whereas if it's a resolvable path name (absolute or
// relative), then that specific path is enforced. An empty path disables IPC.
IPCPath string `toml:",omitempty"`
IPCPath string

// HTTPHost is the host interface on which to start the HTTP RPC server. If this
// field is empty, no HTTP API endpoint will be started.
HTTPHost string `toml:",omitempty"`
HTTPHost string

// HTTPPort is the TCP port number on which to start the HTTP RPC server. The
// default zero value is/ valid and will pick a port number randomly (useful
Expand All @@ -117,15 +117,15 @@ type Config struct {
// HTTPModules is a list of API modules to expose via the HTTP RPC interface.
// If the module list is empty, all RPC API endpoints designated public will be
// exposed.
HTTPModules []string `toml:",omitempty"`
HTTPModules []string

// HTTPTimeouts allows for customization of the timeout values used by the HTTP RPC
// interface.
HTTPTimeouts rpc.HTTPTimeouts

// WSHost is the host interface on which to start the websocket RPC server. If
// this field is empty, no websocket API endpoint will be started.
WSHost string `toml:",omitempty"`
WSHost string

// WSPort is the TCP port number on which to start the websocket RPC server. The
// default zero value is/ valid and will pick a port number randomly (useful for
Expand All @@ -140,7 +140,7 @@ type Config struct {
// WSModules is a list of API modules to expose via the websocket RPC interface.
// If the module list is empty, all RPC API endpoints designated public will be
// exposed.
WSModules []string `toml:",omitempty"`
WSModules []string

// WSExposeAll exposes all API modules via the WebSocket RPC interface rather
// than just the public ones.
Expand Down

0 comments on commit 63a53f9

Please sign in to comment.