diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2019-01-24 19:02:18 +0800 |
---|---|---|
committer | Rafael Matias <rafael@skyle.net> | 2019-02-19 19:56:30 +0800 |
commit | 4976fcc91a43b5c7047c51a03985887b694f0fbb (patch) | |
tree | c2aef8ce616498f44d38a6a830c211112e0a6d71 /cmd/swarm/config.go | |
parent | 878aa58ec66ffc541a80aa65ee35261efa086c9c (diff) | |
download | dexon-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar dexon-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.gz dexon-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.bz2 dexon-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.lz dexon-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.xz dexon-4976fcc91a43b5c7047c51a03985887b694f0fbb.tar.zst dexon-4976fcc91a43b5c7047c51a03985887b694f0fbb.zip |
swarm: bootnode-mode, new bootnodes and no p2p package discovery (#18498)
(cherry picked from commit bbd120354a8d226b446591eeda9f9462cb9b690a)
Diffstat (limited to 'cmd/swarm/config.go')
-rw-r--r-- | cmd/swarm/config.go | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go index 3eea3057b..0203a6798 100644 --- a/cmd/swarm/config.go +++ b/cmd/swarm/config.go @@ -79,6 +79,7 @@ const ( SWARM_ENV_STORE_PATH = "SWARM_STORE_PATH" SWARM_ENV_STORE_CAPACITY = "SWARM_STORE_CAPACITY" SWARM_ENV_STORE_CACHE_CAPACITY = "SWARM_STORE_CACHE_CAPACITY" + SWARM_ENV_BOOTNODE_MODE = "SWARM_BOOTNODE_MODE" SWARM_ACCESS_PASSWORD = "SWARM_ACCESS_PASSWORD" SWARM_AUTO_DEFAULTPATH = "SWARM_AUTO_DEFAULTPATH" GETH_ENV_DATADIR = "GETH_DATADIR" @@ -164,10 +165,9 @@ func configFileOverride(config *bzzapi.Config, ctx *cli.Context) (*bzzapi.Config return config, err } -//override the current config with whatever is provided through the command line -//most values are not allowed a zero value (empty string), if not otherwise noted +// cmdLineOverride overrides the current config with whatever is provided through the command line +// most values are not allowed a zero value (empty string), if not otherwise noted func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Config { - if keyid := ctx.GlobalString(SwarmAccountFlag.Name); keyid != "" { currentConfig.BzzAccount = keyid } @@ -258,14 +258,17 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con currentConfig.LocalStoreParams.CacheCapacity = storeCacheCapacity } + if ctx.GlobalIsSet(SwarmBootnodeModeFlag.Name) { + currentConfig.BootnodeMode = ctx.GlobalBool(SwarmBootnodeModeFlag.Name) + } + return currentConfig } -//override the current config with whatver is provided in environment variables -//most values are not allowed a zero value (empty string), if not otherwise noted +// envVarsOverride overrides the current config with whatver is provided in environment variables +// most values are not allowed a zero value (empty string), if not otherwise noted func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) { - if keyid := os.Getenv(SWARM_ENV_ACCOUNT); keyid != "" { currentConfig.BzzAccount = keyid } @@ -364,6 +367,14 @@ func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) { currentConfig.Cors = cors } + if bm := os.Getenv(SWARM_ENV_BOOTNODE_MODE); bm != "" { + bootnodeMode, err := strconv.ParseBool(bm) + if err != nil { + utils.Fatalf("invalid environment variable %s: %v", SWARM_ENV_BOOTNODE_MODE, err) + } + currentConfig.BootnodeMode = bootnodeMode + } + return currentConfig } |