Skip to content

Commit 6d8e51a

Browse files
authored
cmd, node: dump empty value config (#21296)
1 parent 6315b6f commit 6d8e51a

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

cmd/utils/flags.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -905,12 +905,15 @@ func setNAT(ctx *cli.Context, cfg *p2p.Config) {
905905

906906
// splitAndTrim splits input separated by a comma
907907
// and trims excessive white space from the substrings.
908-
func splitAndTrim(input string) []string {
909-
result := strings.Split(input, ",")
910-
for i, r := range result {
911-
result[i] = strings.TrimSpace(r)
908+
func splitAndTrim(input string) (ret []string) {
909+
l := strings.Split(input, ",")
910+
for _, r := range l {
911+
r = strings.TrimSpace(r)
912+
if len(r) > 0 {
913+
ret = append(ret, r)
914+
}
912915
}
913-
return result
916+
return ret
914917
}
915918

916919
// setHTTP creates the HTTP RPC listener interface string from the set

node/config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ type Config struct {
102102
// a simple file name, it is placed inside the data directory (or on the root
103103
// pipe path on Windows), whereas if it's a resolvable path name (absolute or
104104
// relative), then that specific path is enforced. An empty path disables IPC.
105-
IPCPath string `toml:",omitempty"`
105+
IPCPath string
106106

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

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

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

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

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

158158
// WSExposeAll exposes all API modules via the WebSocket RPC interface rather
159159
// than just the public ones.
@@ -164,7 +164,7 @@ type Config struct {
164164

165165
// GraphQLHost is the host interface on which to start the GraphQL server. If this
166166
// field is empty, no GraphQL API endpoint will be started.
167-
GraphQLHost string `toml:",omitempty"`
167+
GraphQLHost string
168168

169169
// GraphQLPort is the TCP port number on which to start the GraphQL server. The
170170
// default zero value is/ valid and will pick a port number randomly (useful

0 commit comments

Comments
 (0)