@@ -162,7 +162,7 @@ var (
162162 DocRootFlag = DirectoryFlag {
163163 Name : "docroot" ,
164164 Usage : "Document Root for HTTPClient file scheme" ,
165- Value : DirectoryString (homeDir ()),
165+ Value : DirectoryString (HomeDir ()),
166166 }
167167 ExitWhenSyncedFlag = cli.BoolFlag {
168168 Name : "exitwhensynced" ,
@@ -793,9 +793,9 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
793793 switch {
794794 case ctx .GlobalIsSet (BootnodesFlag .Name ) || ctx .GlobalIsSet (LegacyBootnodesV4Flag .Name ):
795795 if ctx .GlobalIsSet (LegacyBootnodesV4Flag .Name ) {
796- urls = splitAndTrim (ctx .GlobalString (LegacyBootnodesV4Flag .Name ))
796+ urls = SplitAndTrim (ctx .GlobalString (LegacyBootnodesV4Flag .Name ))
797797 } else {
798- urls = splitAndTrim (ctx .GlobalString (BootnodesFlag .Name ))
798+ urls = SplitAndTrim (ctx .GlobalString (BootnodesFlag .Name ))
799799 }
800800 case ctx .GlobalBool (LegacyTestnetFlag .Name ) || ctx .GlobalBool (RopstenFlag .Name ):
801801 urls = params .RopstenBootnodes
@@ -829,9 +829,9 @@ func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
829829 switch {
830830 case ctx .GlobalIsSet (BootnodesFlag .Name ) || ctx .GlobalIsSet (LegacyBootnodesV5Flag .Name ):
831831 if ctx .GlobalIsSet (LegacyBootnodesV5Flag .Name ) {
832- urls = splitAndTrim (ctx .GlobalString (LegacyBootnodesV5Flag .Name ))
832+ urls = SplitAndTrim (ctx .GlobalString (LegacyBootnodesV5Flag .Name ))
833833 } else {
834- urls = splitAndTrim (ctx .GlobalString (BootnodesFlag .Name ))
834+ urls = SplitAndTrim (ctx .GlobalString (BootnodesFlag .Name ))
835835 }
836836 case ctx .GlobalBool (RopstenFlag .Name ):
837837 urls = params .RopstenBootnodes
@@ -877,13 +877,12 @@ func setNAT(ctx *cli.Context, cfg *p2p.Config) {
877877 }
878878}
879879
880- // splitAndTrim splits input separated by a comma
880+ // SplitAndTrim splits input separated by a comma
881881// and trims excessive white space from the substrings.
882- func splitAndTrim (input string ) (ret []string ) {
882+ func SplitAndTrim (input string ) (ret []string ) {
883883 l := strings .Split (input , "," )
884884 for _ , r := range l {
885- r = strings .TrimSpace (r )
886- if len (r ) > 0 {
885+ if r = strings .TrimSpace (r ); r != "" {
887886 ret = append (ret , r )
888887 }
889888 }
@@ -917,38 +916,38 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
917916 }
918917
919918 if ctx .GlobalIsSet (LegacyRPCCORSDomainFlag .Name ) {
920- cfg .HTTPCors = splitAndTrim (ctx .GlobalString (LegacyRPCCORSDomainFlag .Name ))
919+ cfg .HTTPCors = SplitAndTrim (ctx .GlobalString (LegacyRPCCORSDomainFlag .Name ))
921920 log .Warn ("The flag --rpccorsdomain is deprecated and will be removed in the future, please use --http.corsdomain" )
922921 }
923922 if ctx .GlobalIsSet (HTTPCORSDomainFlag .Name ) {
924- cfg .HTTPCors = splitAndTrim (ctx .GlobalString (HTTPCORSDomainFlag .Name ))
923+ cfg .HTTPCors = SplitAndTrim (ctx .GlobalString (HTTPCORSDomainFlag .Name ))
925924 }
926925
927926 if ctx .GlobalIsSet (LegacyRPCApiFlag .Name ) {
928- cfg .HTTPModules = splitAndTrim (ctx .GlobalString (LegacyRPCApiFlag .Name ))
927+ cfg .HTTPModules = SplitAndTrim (ctx .GlobalString (LegacyRPCApiFlag .Name ))
929928 log .Warn ("The flag --rpcapi is deprecated and will be removed in the future, please use --http.api" )
930929 }
931930 if ctx .GlobalIsSet (HTTPApiFlag .Name ) {
932- cfg .HTTPModules = splitAndTrim (ctx .GlobalString (HTTPApiFlag .Name ))
931+ cfg .HTTPModules = SplitAndTrim (ctx .GlobalString (HTTPApiFlag .Name ))
933932 }
934933
935934 if ctx .GlobalIsSet (LegacyRPCVirtualHostsFlag .Name ) {
936- cfg .HTTPVirtualHosts = splitAndTrim (ctx .GlobalString (LegacyRPCVirtualHostsFlag .Name ))
935+ cfg .HTTPVirtualHosts = SplitAndTrim (ctx .GlobalString (LegacyRPCVirtualHostsFlag .Name ))
937936 log .Warn ("The flag --rpcvhosts is deprecated and will be removed in the future, please use --http.vhosts" )
938937 }
939938 if ctx .GlobalIsSet (HTTPVirtualHostsFlag .Name ) {
940- cfg .HTTPVirtualHosts = splitAndTrim (ctx .GlobalString (HTTPVirtualHostsFlag .Name ))
939+ cfg .HTTPVirtualHosts = SplitAndTrim (ctx .GlobalString (HTTPVirtualHostsFlag .Name ))
941940 }
942941}
943942
944943// setGraphQL creates the GraphQL listener interface string from the set
945944// command line flags, returning empty if the GraphQL endpoint is disabled.
946945func setGraphQL (ctx * cli.Context , cfg * node.Config ) {
947946 if ctx .GlobalIsSet (GraphQLCORSDomainFlag .Name ) {
948- cfg .GraphQLCors = splitAndTrim (ctx .GlobalString (GraphQLCORSDomainFlag .Name ))
947+ cfg .GraphQLCors = SplitAndTrim (ctx .GlobalString (GraphQLCORSDomainFlag .Name ))
949948 }
950949 if ctx .GlobalIsSet (GraphQLVirtualHostsFlag .Name ) {
951- cfg .GraphQLVirtualHosts = splitAndTrim (ctx .GlobalString (GraphQLVirtualHostsFlag .Name ))
950+ cfg .GraphQLVirtualHosts = SplitAndTrim (ctx .GlobalString (GraphQLVirtualHostsFlag .Name ))
952951 }
953952}
954953
@@ -974,19 +973,19 @@ func setWS(ctx *cli.Context, cfg *node.Config) {
974973 }
975974
976975 if ctx .GlobalIsSet (LegacyWSAllowedOriginsFlag .Name ) {
977- cfg .WSOrigins = splitAndTrim (ctx .GlobalString (LegacyWSAllowedOriginsFlag .Name ))
976+ cfg .WSOrigins = SplitAndTrim (ctx .GlobalString (LegacyWSAllowedOriginsFlag .Name ))
978977 log .Warn ("The flag --wsorigins is deprecated and will be removed in the future, please use --ws.origins" )
979978 }
980979 if ctx .GlobalIsSet (WSAllowedOriginsFlag .Name ) {
981- cfg .WSOrigins = splitAndTrim (ctx .GlobalString (WSAllowedOriginsFlag .Name ))
980+ cfg .WSOrigins = SplitAndTrim (ctx .GlobalString (WSAllowedOriginsFlag .Name ))
982981 }
983982
984983 if ctx .GlobalIsSet (LegacyWSApiFlag .Name ) {
985- cfg .WSModules = splitAndTrim (ctx .GlobalString (LegacyWSApiFlag .Name ))
984+ cfg .WSModules = SplitAndTrim (ctx .GlobalString (LegacyWSApiFlag .Name ))
986985 log .Warn ("The flag --wsapi is deprecated and will be removed in the future, please use --ws.api" )
987986 }
988987 if ctx .GlobalIsSet (WSApiFlag .Name ) {
989- cfg .WSModules = splitAndTrim (ctx .GlobalString (WSApiFlag .Name ))
988+ cfg .WSModules = SplitAndTrim (ctx .GlobalString (WSApiFlag .Name ))
990989 }
991990}
992991
@@ -1580,7 +1579,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
15801579 if urls == "" {
15811580 cfg .DiscoveryURLs = []string {}
15821581 } else {
1583- cfg .DiscoveryURLs = splitAndTrim (urls )
1582+ cfg .DiscoveryURLs = SplitAndTrim (urls )
15841583 }
15851584 }
15861585
0 commit comments