aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorLewis Marshall <lewis@lmars.net>2017-06-30 17:10:41 +0800
committerLewis Marshall <lewis@lmars.net>2017-06-30 17:16:03 +0800
commitc7041fe1455541e59879df2b2d36984d49d1630b (patch)
treeb30345bbd8dcfcc38589abf1a17ad24c120873a9 /cmd
parent41318f3776f3ecc09c2f482070bddc7433e00b14 (diff)
downloadgo-tangerine-c7041fe1455541e59879df2b2d36984d49d1630b.tar
go-tangerine-c7041fe1455541e59879df2b2d36984d49d1630b.tar.gz
go-tangerine-c7041fe1455541e59879df2b2d36984d49d1630b.tar.bz2
go-tangerine-c7041fe1455541e59879df2b2d36984d49d1630b.tar.lz
go-tangerine-c7041fe1455541e59879df2b2d36984d49d1630b.tar.xz
go-tangerine-c7041fe1455541e59879df2b2d36984d49d1630b.tar.zst
go-tangerine-c7041fe1455541e59879df2b2d36984d49d1630b.zip
cmd/swarm: Exit if --ethapi is set
The previous attempt to use --ethapi as a fallback if --ens-api is not set does not work because --ens-api has a default value, and also setting --ens-api to "" is the suggested way to disable ENS lookups. Signed-off-by: Lewis Marshall <lewis@lmars.net>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/swarm/main.go27
-rw-r--r--cmd/swarm/run_test.go2
2 files changed, 14 insertions, 15 deletions
diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go
index f0680c487..6b4feb0bc 100644
--- a/cmd/swarm/main.go
+++ b/cmd/swarm/main.go
@@ -100,10 +100,6 @@ var (
Name: "sync",
Usage: "Swarm Syncing enabled (default true)",
}
- EthAPIFlag = cli.StringFlag{
- Name: "ethapi",
- Usage: "DEPRECATED: please use --ens-api and --swap-api",
- }
EnsAPIFlag = cli.StringFlag{
Name: "ens-api",
Usage: "URL of the Ethereum API provider to use for ENS record lookups",
@@ -142,6 +138,12 @@ var (
Name: "corsdomain",
Usage: "Domain on which to send Access-Control-Allow-Origin header (multiple domains can be supplied separated by a ',')",
}
+
+ // the following flags are deprecated and should be removed in the future
+ DeprecatedEthAPIFlag = cli.StringFlag{
+ Name: "ethapi",
+ Usage: "DEPRECATED: please use --ens-api and --swap-api",
+ }
)
var defaultNodeConfig = node.DefaultConfig
@@ -266,7 +268,6 @@ Cleans database of corrupted entries.
utils.PasswordFileFlag,
// bzzd-specific flags
CorsStringFlag,
- EthAPIFlag,
EnsAPIFlag,
EnsAddrFlag,
SwarmConfigPathFlag,
@@ -285,6 +286,8 @@ Cleans database of corrupted entries.
SwarmUploadDefaultPath,
SwarmUpFromStdinFlag,
SwarmUploadMimeType,
+ //deprecated flags
+ DeprecatedEthAPIFlag,
}
app.Flags = append(app.Flags, debug.Flags...)
app.Before = func(ctx *cli.Context) error {
@@ -319,6 +322,11 @@ func version(ctx *cli.Context) error {
}
func bzzd(ctx *cli.Context) error {
+ // exit if the deprecated --ethapi flag is set
+ if ctx.GlobalString(DeprecatedEthAPIFlag.Name) != "" {
+ utils.Fatalf("--ethapi is no longer a valid command line flag, please use --ens-api and/or --swap-api.")
+ }
+
cfg := defaultNodeConfig
utils.SetNodeConfig(ctx, &cfg)
stack, err := node.New(&cfg)
@@ -408,21 +416,12 @@ func registerBzzService(ctx *cli.Context, stack *node.Node) {
swapEnabled := ctx.GlobalBool(SwarmSwapEnabledFlag.Name)
syncEnabled := ctx.GlobalBoolT(SwarmSyncEnabledFlag.Name)
- ethapi := ctx.GlobalString(EthAPIFlag.Name)
- if ethapi != "" {
- log.Warn("DEPRECATED: --ethapi is deprecated and will be removed in a future version, please use --ens-api and --swap-api")
- }
-
swapapi := ctx.GlobalString(SwarmSwapAPIFlag.Name)
if swapEnabled && swapapi == "" {
utils.Fatalf("SWAP is enabled but --swap-api is not set")
}
ensapi := ctx.GlobalString(EnsAPIFlag.Name)
- // use the deprecated --ethapi if --ens-api is not set
- if ensapi == "" {
- ensapi = ethapi
- }
ensAddr := ctx.GlobalString(EnsAddrFlag.Name)
cors := ctx.GlobalString(CorsStringFlag.Name)
diff --git a/cmd/swarm/run_test.go b/cmd/swarm/run_test.go
index 2d32a51c8..05cbb27f1 100644
--- a/cmd/swarm/run_test.go
+++ b/cmd/swarm/run_test.go
@@ -194,7 +194,7 @@ func newTestNode(t *testing.T, dir string) *testNode {
"--nodiscover",
"--datadir", dir,
"--ipcpath", conf.IPCPath,
- "--ethapi", "",
+ "--ens-api", "",
"--bzzaccount", account.Address.String(),
"--bzznetworkid", "321",
"--bzzport", httpPort,