@@ -162,7 +162,7 @@ var (
162
162
DocRootFlag = DirectoryFlag {
163
163
Name : "docroot" ,
164
164
Usage : "Document Root for HTTPClient file scheme" ,
165
- Value : DirectoryString (homeDir ()),
165
+ Value : DirectoryString (HomeDir ()),
166
166
}
167
167
ExitWhenSyncedFlag = cli.BoolFlag {
168
168
Name : "exitwhensynced" ,
@@ -793,9 +793,9 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
793
793
switch {
794
794
case ctx .GlobalIsSet (BootnodesFlag .Name ) || ctx .GlobalIsSet (LegacyBootnodesV4Flag .Name ):
795
795
if ctx .GlobalIsSet (LegacyBootnodesV4Flag .Name ) {
796
- urls = splitAndTrim (ctx .GlobalString (LegacyBootnodesV4Flag .Name ))
796
+ urls = SplitAndTrim (ctx .GlobalString (LegacyBootnodesV4Flag .Name ))
797
797
} else {
798
- urls = splitAndTrim (ctx .GlobalString (BootnodesFlag .Name ))
798
+ urls = SplitAndTrim (ctx .GlobalString (BootnodesFlag .Name ))
799
799
}
800
800
case ctx .GlobalBool (LegacyTestnetFlag .Name ) || ctx .GlobalBool (RopstenFlag .Name ):
801
801
urls = params .RopstenBootnodes
@@ -829,9 +829,9 @@ func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
829
829
switch {
830
830
case ctx .GlobalIsSet (BootnodesFlag .Name ) || ctx .GlobalIsSet (LegacyBootnodesV5Flag .Name ):
831
831
if ctx .GlobalIsSet (LegacyBootnodesV5Flag .Name ) {
832
- urls = splitAndTrim (ctx .GlobalString (LegacyBootnodesV5Flag .Name ))
832
+ urls = SplitAndTrim (ctx .GlobalString (LegacyBootnodesV5Flag .Name ))
833
833
} else {
834
- urls = splitAndTrim (ctx .GlobalString (BootnodesFlag .Name ))
834
+ urls = SplitAndTrim (ctx .GlobalString (BootnodesFlag .Name ))
835
835
}
836
836
case ctx .GlobalBool (RopstenFlag .Name ):
837
837
urls = params .RopstenBootnodes
@@ -877,13 +877,12 @@ func setNAT(ctx *cli.Context, cfg *p2p.Config) {
877
877
}
878
878
}
879
879
880
- // splitAndTrim splits input separated by a comma
880
+ // SplitAndTrim splits input separated by a comma
881
881
// and trims excessive white space from the substrings.
882
- func splitAndTrim (input string ) (ret []string ) {
882
+ func SplitAndTrim (input string ) (ret []string ) {
883
883
l := strings .Split (input , "," )
884
884
for _ , r := range l {
885
- r = strings .TrimSpace (r )
886
- if len (r ) > 0 {
885
+ if r = strings .TrimSpace (r ); r != "" {
887
886
ret = append (ret , r )
888
887
}
889
888
}
@@ -917,38 +916,38 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
917
916
}
918
917
919
918
if ctx .GlobalIsSet (LegacyRPCCORSDomainFlag .Name ) {
920
- cfg .HTTPCors = splitAndTrim (ctx .GlobalString (LegacyRPCCORSDomainFlag .Name ))
919
+ cfg .HTTPCors = SplitAndTrim (ctx .GlobalString (LegacyRPCCORSDomainFlag .Name ))
921
920
log .Warn ("The flag --rpccorsdomain is deprecated and will be removed in the future, please use --http.corsdomain" )
922
921
}
923
922
if ctx .GlobalIsSet (HTTPCORSDomainFlag .Name ) {
924
- cfg .HTTPCors = splitAndTrim (ctx .GlobalString (HTTPCORSDomainFlag .Name ))
923
+ cfg .HTTPCors = SplitAndTrim (ctx .GlobalString (HTTPCORSDomainFlag .Name ))
925
924
}
926
925
927
926
if ctx .GlobalIsSet (LegacyRPCApiFlag .Name ) {
928
- cfg .HTTPModules = splitAndTrim (ctx .GlobalString (LegacyRPCApiFlag .Name ))
927
+ cfg .HTTPModules = SplitAndTrim (ctx .GlobalString (LegacyRPCApiFlag .Name ))
929
928
log .Warn ("The flag --rpcapi is deprecated and will be removed in the future, please use --http.api" )
930
929
}
931
930
if ctx .GlobalIsSet (HTTPApiFlag .Name ) {
932
- cfg .HTTPModules = splitAndTrim (ctx .GlobalString (HTTPApiFlag .Name ))
931
+ cfg .HTTPModules = SplitAndTrim (ctx .GlobalString (HTTPApiFlag .Name ))
933
932
}
934
933
935
934
if ctx .GlobalIsSet (LegacyRPCVirtualHostsFlag .Name ) {
936
- cfg .HTTPVirtualHosts = splitAndTrim (ctx .GlobalString (LegacyRPCVirtualHostsFlag .Name ))
935
+ cfg .HTTPVirtualHosts = SplitAndTrim (ctx .GlobalString (LegacyRPCVirtualHostsFlag .Name ))
937
936
log .Warn ("The flag --rpcvhosts is deprecated and will be removed in the future, please use --http.vhosts" )
938
937
}
939
938
if ctx .GlobalIsSet (HTTPVirtualHostsFlag .Name ) {
940
- cfg .HTTPVirtualHosts = splitAndTrim (ctx .GlobalString (HTTPVirtualHostsFlag .Name ))
939
+ cfg .HTTPVirtualHosts = SplitAndTrim (ctx .GlobalString (HTTPVirtualHostsFlag .Name ))
941
940
}
942
941
}
943
942
944
943
// setGraphQL creates the GraphQL listener interface string from the set
945
944
// command line flags, returning empty if the GraphQL endpoint is disabled.
946
945
func setGraphQL (ctx * cli.Context , cfg * node.Config ) {
947
946
if ctx .GlobalIsSet (GraphQLCORSDomainFlag .Name ) {
948
- cfg .GraphQLCors = splitAndTrim (ctx .GlobalString (GraphQLCORSDomainFlag .Name ))
947
+ cfg .GraphQLCors = SplitAndTrim (ctx .GlobalString (GraphQLCORSDomainFlag .Name ))
949
948
}
950
949
if ctx .GlobalIsSet (GraphQLVirtualHostsFlag .Name ) {
951
- cfg .GraphQLVirtualHosts = splitAndTrim (ctx .GlobalString (GraphQLVirtualHostsFlag .Name ))
950
+ cfg .GraphQLVirtualHosts = SplitAndTrim (ctx .GlobalString (GraphQLVirtualHostsFlag .Name ))
952
951
}
953
952
}
954
953
@@ -974,19 +973,19 @@ func setWS(ctx *cli.Context, cfg *node.Config) {
974
973
}
975
974
976
975
if ctx .GlobalIsSet (LegacyWSAllowedOriginsFlag .Name ) {
977
- cfg .WSOrigins = splitAndTrim (ctx .GlobalString (LegacyWSAllowedOriginsFlag .Name ))
976
+ cfg .WSOrigins = SplitAndTrim (ctx .GlobalString (LegacyWSAllowedOriginsFlag .Name ))
978
977
log .Warn ("The flag --wsorigins is deprecated and will be removed in the future, please use --ws.origins" )
979
978
}
980
979
if ctx .GlobalIsSet (WSAllowedOriginsFlag .Name ) {
981
- cfg .WSOrigins = splitAndTrim (ctx .GlobalString (WSAllowedOriginsFlag .Name ))
980
+ cfg .WSOrigins = SplitAndTrim (ctx .GlobalString (WSAllowedOriginsFlag .Name ))
982
981
}
983
982
984
983
if ctx .GlobalIsSet (LegacyWSApiFlag .Name ) {
985
- cfg .WSModules = splitAndTrim (ctx .GlobalString (LegacyWSApiFlag .Name ))
984
+ cfg .WSModules = SplitAndTrim (ctx .GlobalString (LegacyWSApiFlag .Name ))
986
985
log .Warn ("The flag --wsapi is deprecated and will be removed in the future, please use --ws.api" )
987
986
}
988
987
if ctx .GlobalIsSet (WSApiFlag .Name ) {
989
- cfg .WSModules = splitAndTrim (ctx .GlobalString (WSApiFlag .Name ))
988
+ cfg .WSModules = SplitAndTrim (ctx .GlobalString (WSApiFlag .Name ))
990
989
}
991
990
}
992
991
@@ -1580,7 +1579,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
1580
1579
if urls == "" {
1581
1580
cfg .DiscoveryURLs = []string {}
1582
1581
} else {
1583
- cfg .DiscoveryURLs = splitAndTrim (urls )
1582
+ cfg .DiscoveryURLs = SplitAndTrim (urls )
1584
1583
}
1585
1584
}
1586
1585
0 commit comments