|
|
|
@ -162,7 +162,7 @@ var ( |
|
|
|
|
DocRootFlag = DirectoryFlag{ |
|
|
|
|
Name: "docroot", |
|
|
|
|
Usage: "Document Root for HTTPClient file scheme", |
|
|
|
|
Value: DirectoryString(homeDir()), |
|
|
|
|
Value: DirectoryString(HomeDir()), |
|
|
|
|
} |
|
|
|
|
ExitWhenSyncedFlag = cli.BoolFlag{ |
|
|
|
|
Name: "exitwhensynced", |
|
|
|
@ -793,9 +793,9 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) { |
|
|
|
|
switch { |
|
|
|
|
case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(LegacyBootnodesV4Flag.Name): |
|
|
|
|
if ctx.GlobalIsSet(LegacyBootnodesV4Flag.Name) { |
|
|
|
|
urls = splitAndTrim(ctx.GlobalString(LegacyBootnodesV4Flag.Name)) |
|
|
|
|
urls = SplitAndTrim(ctx.GlobalString(LegacyBootnodesV4Flag.Name)) |
|
|
|
|
} else { |
|
|
|
|
urls = splitAndTrim(ctx.GlobalString(BootnodesFlag.Name)) |
|
|
|
|
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name)) |
|
|
|
|
} |
|
|
|
|
case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name): |
|
|
|
|
urls = params.RopstenBootnodes |
|
|
|
@ -829,9 +829,9 @@ func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) { |
|
|
|
|
switch { |
|
|
|
|
case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(LegacyBootnodesV5Flag.Name): |
|
|
|
|
if ctx.GlobalIsSet(LegacyBootnodesV5Flag.Name) { |
|
|
|
|
urls = splitAndTrim(ctx.GlobalString(LegacyBootnodesV5Flag.Name)) |
|
|
|
|
urls = SplitAndTrim(ctx.GlobalString(LegacyBootnodesV5Flag.Name)) |
|
|
|
|
} else { |
|
|
|
|
urls = splitAndTrim(ctx.GlobalString(BootnodesFlag.Name)) |
|
|
|
|
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name)) |
|
|
|
|
} |
|
|
|
|
case ctx.GlobalBool(RopstenFlag.Name): |
|
|
|
|
urls = params.RopstenBootnodes |
|
|
|
@ -877,13 +877,12 @@ func setNAT(ctx *cli.Context, cfg *p2p.Config) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// splitAndTrim splits input separated by a comma
|
|
|
|
|
// SplitAndTrim splits input separated by a comma
|
|
|
|
|
// and trims excessive white space from the substrings.
|
|
|
|
|
func splitAndTrim(input string) (ret []string) { |
|
|
|
|
func SplitAndTrim(input string) (ret []string) { |
|
|
|
|
l := strings.Split(input, ",") |
|
|
|
|
for _, r := range l { |
|
|
|
|
r = strings.TrimSpace(r) |
|
|
|
|
if len(r) > 0 { |
|
|
|
|
if r = strings.TrimSpace(r); r != "" { |
|
|
|
|
ret = append(ret, r) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -917,27 +916,27 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ctx.GlobalIsSet(LegacyRPCCORSDomainFlag.Name) { |
|
|
|
|
cfg.HTTPCors = splitAndTrim(ctx.GlobalString(LegacyRPCCORSDomainFlag.Name)) |
|
|
|
|
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(LegacyRPCCORSDomainFlag.Name)) |
|
|
|
|
log.Warn("The flag --rpccorsdomain is deprecated and will be removed in the future, please use --http.corsdomain") |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(HTTPCORSDomainFlag.Name) { |
|
|
|
|
cfg.HTTPCors = splitAndTrim(ctx.GlobalString(HTTPCORSDomainFlag.Name)) |
|
|
|
|
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(HTTPCORSDomainFlag.Name)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ctx.GlobalIsSet(LegacyRPCApiFlag.Name) { |
|
|
|
|
cfg.HTTPModules = splitAndTrim(ctx.GlobalString(LegacyRPCApiFlag.Name)) |
|
|
|
|
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(LegacyRPCApiFlag.Name)) |
|
|
|
|
log.Warn("The flag --rpcapi is deprecated and will be removed in the future, please use --http.api") |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(HTTPApiFlag.Name) { |
|
|
|
|
cfg.HTTPModules = splitAndTrim(ctx.GlobalString(HTTPApiFlag.Name)) |
|
|
|
|
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(HTTPApiFlag.Name)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ctx.GlobalIsSet(LegacyRPCVirtualHostsFlag.Name) { |
|
|
|
|
cfg.HTTPVirtualHosts = splitAndTrim(ctx.GlobalString(LegacyRPCVirtualHostsFlag.Name)) |
|
|
|
|
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(LegacyRPCVirtualHostsFlag.Name)) |
|
|
|
|
log.Warn("The flag --rpcvhosts is deprecated and will be removed in the future, please use --http.vhosts") |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(HTTPVirtualHostsFlag.Name) { |
|
|
|
|
cfg.HTTPVirtualHosts = splitAndTrim(ctx.GlobalString(HTTPVirtualHostsFlag.Name)) |
|
|
|
|
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(HTTPVirtualHostsFlag.Name)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -945,10 +944,10 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { |
|
|
|
|
// command line flags, returning empty if the GraphQL endpoint is disabled.
|
|
|
|
|
func setGraphQL(ctx *cli.Context, cfg *node.Config) { |
|
|
|
|
if ctx.GlobalIsSet(GraphQLCORSDomainFlag.Name) { |
|
|
|
|
cfg.GraphQLCors = splitAndTrim(ctx.GlobalString(GraphQLCORSDomainFlag.Name)) |
|
|
|
|
cfg.GraphQLCors = SplitAndTrim(ctx.GlobalString(GraphQLCORSDomainFlag.Name)) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(GraphQLVirtualHostsFlag.Name) { |
|
|
|
|
cfg.GraphQLVirtualHosts = splitAndTrim(ctx.GlobalString(GraphQLVirtualHostsFlag.Name)) |
|
|
|
|
cfg.GraphQLVirtualHosts = SplitAndTrim(ctx.GlobalString(GraphQLVirtualHostsFlag.Name)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -974,19 +973,19 @@ func setWS(ctx *cli.Context, cfg *node.Config) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ctx.GlobalIsSet(LegacyWSAllowedOriginsFlag.Name) { |
|
|
|
|
cfg.WSOrigins = splitAndTrim(ctx.GlobalString(LegacyWSAllowedOriginsFlag.Name)) |
|
|
|
|
cfg.WSOrigins = SplitAndTrim(ctx.GlobalString(LegacyWSAllowedOriginsFlag.Name)) |
|
|
|
|
log.Warn("The flag --wsorigins is deprecated and will be removed in the future, please use --ws.origins") |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(WSAllowedOriginsFlag.Name) { |
|
|
|
|
cfg.WSOrigins = splitAndTrim(ctx.GlobalString(WSAllowedOriginsFlag.Name)) |
|
|
|
|
cfg.WSOrigins = SplitAndTrim(ctx.GlobalString(WSAllowedOriginsFlag.Name)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ctx.GlobalIsSet(LegacyWSApiFlag.Name) { |
|
|
|
|
cfg.WSModules = splitAndTrim(ctx.GlobalString(LegacyWSApiFlag.Name)) |
|
|
|
|
cfg.WSModules = SplitAndTrim(ctx.GlobalString(LegacyWSApiFlag.Name)) |
|
|
|
|
log.Warn("The flag --wsapi is deprecated and will be removed in the future, please use --ws.api") |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(WSApiFlag.Name) { |
|
|
|
|
cfg.WSModules = splitAndTrim(ctx.GlobalString(WSApiFlag.Name)) |
|
|
|
|
cfg.WSModules = SplitAndTrim(ctx.GlobalString(WSApiFlag.Name)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1580,7 +1579,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { |
|
|
|
|
if urls == "" { |
|
|
|
|
cfg.DiscoveryURLs = []string{} |
|
|
|
|
} else { |
|
|
|
|
cfg.DiscoveryURLs = splitAndTrim(urls) |
|
|
|
|
cfg.DiscoveryURLs = SplitAndTrim(urls) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|