swarm: deprecate --ens-addr CLI flag with a warning message

This commit is contained in:
Janos Guljas 2017-12-04 22:41:21 +01:00
parent 3732c15faa
commit e451b65fae

View File

@ -101,10 +101,6 @@ var (
Name: "ens-api", Name: "ens-api",
Usage: "ENS API endpoint for a TLD and with contract address, can be repeated, format [tld:][contract-addr@]url", Usage: "ENS API endpoint for a TLD and with contract address, can be repeated, format [tld:][contract-addr@]url",
} }
EnsAddrFlag = cli.StringFlag{
Name: "ens-addr",
Usage: "ENS contract address (default is detected as testnet or mainnet using --ens-api)",
}
SwarmApiFlag = cli.StringFlag{ SwarmApiFlag = cli.StringFlag{
Name: "bzzapi", Name: "bzzapi",
Usage: "Swarm HTTP endpoint", Usage: "Swarm HTTP endpoint",
@ -140,6 +136,10 @@ var (
Name: "ethapi", Name: "ethapi",
Usage: "DEPRECATED: please use --ens-api and --swap-api", Usage: "DEPRECATED: please use --ens-api and --swap-api",
} }
DeprecatedEnsAddrFlag = cli.StringFlag{
Name: "ens-addr",
Usage: "DEPRECATED: ENS contract address, please use --ens-api with contract address according to its format",
}
) )
var defaultNodeConfig = node.DefaultConfig var defaultNodeConfig = node.DefaultConfig
@ -319,7 +319,6 @@ DEPRECATED: use 'swarm db clean'.
// bzzd-specific flags // bzzd-specific flags
CorsStringFlag, CorsStringFlag,
EnsAPIFlag, EnsAPIFlag,
EnsAddrFlag,
SwarmConfigPathFlag, SwarmConfigPathFlag,
SwarmSwapEnabledFlag, SwarmSwapEnabledFlag,
SwarmSwapAPIFlag, SwarmSwapAPIFlag,
@ -338,6 +337,7 @@ DEPRECATED: use 'swarm db clean'.
SwarmUploadMimeType, SwarmUploadMimeType,
//deprecated flags //deprecated flags
DeprecatedEthAPIFlag, DeprecatedEthAPIFlag,
DeprecatedEnsAddrFlag,
} }
app.Flags = append(app.Flags, debug.Flags...) app.Flags = append(app.Flags, debug.Flags...)
app.Before = func(ctx *cli.Context) error { app.Before = func(ctx *cli.Context) error {
@ -440,7 +440,11 @@ func registerBzzService(ctx *cli.Context, stack *node.Node) {
} }
ensAPIs := ctx.GlobalStringSlice(EnsAPIFlag.Name) ensAPIs := ctx.GlobalStringSlice(EnsAPIFlag.Name)
ensAddr := ctx.GlobalString(EnsAddrFlag.Name) ensAddr := ctx.GlobalString(DeprecatedEnsAddrFlag.Name)
if ensAddr != "" {
log.Warn("--ens-addr is no longer a valid command line flag, please use --ens-api to specify contract address.")
}
cors := ctx.GlobalString(CorsStringFlag.Name) cors := ctx.GlobalString(CorsStringFlag.Name)