aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2017-12-18 23:22:39 +0800
committerJanos Guljas <janos@resenje.org>2017-12-18 23:22:39 +0800
commitc0a4d9e1e64a09a19484c8c12e24505d9bacbd57 (patch)
tree1ccb0df96f947a17a23dcdf84a6871bd4a9759ba /cmd/swarm
parent47a801455966298d1d1519eebb955024c8f02b84 (diff)
downloaddexon-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.tar.gz
dexon-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.tar.zst
dexon-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.zip
cmd/swarm, swarm: disable ENS API by default
Specifying ENS API CLI flag, env variable or configuration field is required for ENS resolving. Backward compatibility is preserved with --ens-api="" CLI flag value.
Diffstat (limited to 'cmd/swarm')
-rw-r--r--cmd/swarm/config.go23
1 files changed, 5 insertions, 18 deletions
diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go
index 9931b12a2..c66a2a4fe 100644
--- a/cmd/swarm/config.go
+++ b/cmd/swarm/config.go
@@ -195,17 +195,13 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con
utils.Fatalf(SWARM_ERR_SWAP_SET_NO_API)
}
- //EnsAPIs can be set to "", so can't check for empty string, as it is allowed!
if ctx.GlobalIsSet(EnsAPIFlag.Name) {
ensAPIs := ctx.GlobalStringSlice(EnsAPIFlag.Name)
- // Disable ENS resolver if --ens-api="" is specified
+ // preserve backward compatibility to disable ENS with --ens-api=""
if len(ensAPIs) == 1 && ensAPIs[0] == "" {
- currentConfig.EnsDisabled = true
- currentConfig.EnsAPIs = nil
- } else {
- currentConfig.EnsDisabled = false
- currentConfig.EnsAPIs = ensAPIs
+ ensAPIs = nil
}
+ currentConfig.EnsAPIs = ensAPIs
}
if ensaddr := ctx.GlobalString(DeprecatedEnsAddrFlag.Name); ensaddr != "" {
@@ -275,17 +271,8 @@ func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) {
utils.Fatalf(SWARM_ERR_SWAP_SET_NO_API)
}
- //EnsAPIs can be set to "", so can't check for empty string, as it is allowed
- if ensapi, exists := os.LookupEnv(SWARM_ENV_ENS_API); exists {
- ensAPIs := strings.Split(ensapi, ",")
- // Disable ENS resolver if SWARM_ENS_API="" is specified
- if len(ensAPIs) == 0 {
- currentConfig.EnsDisabled = true
- currentConfig.EnsAPIs = nil
- } else {
- currentConfig.EnsDisabled = false
- currentConfig.EnsAPIs = ensAPIs
- }
+ if ensapi := os.Getenv(SWARM_ENV_ENS_API); ensapi != "" {
+ currentConfig.EnsAPIs = strings.Split(ensapi, ",")
}
if ensaddr := os.Getenv(SWARM_ENV_ENS_ADDR); ensaddr != "" {