aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2016-04-14 22:18:35 +0800
committerBas van Kervel <bas@ethdev.com>2016-04-14 22:23:43 +0800
commit529897ea2b08033d10d3e9e65b3658f153432b3d (patch)
treea537bce35faa3e282c7f9f2cf34d483ce0004117
parente50e3bea495d96de9e67d4e9ab6fd9a9de7ba551 (diff)
downloaddexon-529897ea2b08033d10d3e9e65b3658f153432b3d.tar
dexon-529897ea2b08033d10d3e9e65b3658f153432b3d.tar.gz
dexon-529897ea2b08033d10d3e9e65b3658f153432b3d.tar.bz2
dexon-529897ea2b08033d10d3e9e65b3658f153432b3d.tar.lz
dexon-529897ea2b08033d10d3e9e65b3658f153432b3d.tar.xz
dexon-529897ea2b08033d10d3e9e65b3658f153432b3d.tar.zst
dexon-529897ea2b08033d10d3e9e65b3658f153432b3d.zip
cmd/utils: strip excessive whitespace from api command line arguments
-rw-r--r--cmd/utils/flags.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index ceed04cd3..52060c795 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -500,6 +500,16 @@ func MakeNAT(ctx *cli.Context) nat.Interface {
return natif
}
+// MakeRPCModules splits input separated by a comma and trims excessive white
+// space from the substrings.
+func MakeRPCModules(input string) []string {
+ result := strings.Split(input, ",")
+ for i, r := range result {
+ result[i] = strings.TrimSpace(r)
+ }
+ return result
+}
+
// MakeHTTPRpcHost creates the HTTP RPC listener interface string from the set
// command line flags, returning empty if the HTTP endpoint is disabled.
func MakeHTTPRpcHost(ctx *cli.Context) string {
@@ -652,11 +662,11 @@ func MakeSystemNode(name, version string, extra []byte, ctx *cli.Context) *node.
HTTPHost: MakeHTTPRpcHost(ctx),
HTTPPort: ctx.GlobalInt(RPCPortFlag.Name),
HTTPCors: ctx.GlobalString(RPCCORSDomainFlag.Name),
- HTTPModules: strings.Split(ctx.GlobalString(RPCApiFlag.Name), ","),
+ HTTPModules: MakeRPCModules(ctx.GlobalString(RPCApiFlag.Name)),
WSHost: MakeWSRpcHost(ctx),
WSPort: ctx.GlobalInt(WSPortFlag.Name),
WSOrigins: ctx.GlobalString(WSAllowedOriginsFlag.Name),
- WSModules: strings.Split(ctx.GlobalString(WSApiFlag.Name), ","),
+ WSModules: MakeRPCModules(ctx.GlobalString(WSApiFlag.Name)),
}
// Configure the Ethereum service
accman := MakeAccountManager(ctx)