aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm/config.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2019-02-20 16:48:12 +0800
committerGitHub <noreply@github.com>2019-02-20 16:48:12 +0800
commitc942700427557e3ff6de3aaf6b916e2f056c1ec2 (patch)
treecadf68e7206d6de42b1eefc6967214cf86e35ff2 /cmd/swarm/config.go
parent7fa3509e2eaf1a4ebc12344590e5699406690f15 (diff)
parentcde35439e058b4f9579830fec9fb65ae0b998346 (diff)
downloadgo-tangerine-1.8.23.tar
go-tangerine-1.8.23.tar.gz
go-tangerine-1.8.23.tar.bz2
go-tangerine-1.8.23.tar.lz
go-tangerine-1.8.23.tar.xz
go-tangerine-1.8.23.tar.zst
go-tangerine-1.8.23.zip
Merge pull request #19029 from holiman/update1.8v1.8.23
Update1.8
Diffstat (limited to 'cmd/swarm/config.go')
-rw-r--r--cmd/swarm/config.go32
1 files changed, 26 insertions, 6 deletions
diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go
index 3eea3057b..98d4dee7b 100644
--- a/cmd/swarm/config.go
+++ b/cmd/swarm/config.go
@@ -79,8 +79,10 @@ 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"
+ SWARM_GLOBALSTORE_API = "SWARM_GLOBALSTORE_API"
GETH_ENV_DATADIR = "GETH_DATADIR"
)
@@ -164,10 +166,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 +259,21 @@ 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)
+ }
+
+ if ctx.GlobalIsSet(SwarmGlobalStoreAPIFlag.Name) {
+ currentConfig.GlobalStoreAPI = ctx.GlobalString(SwarmGlobalStoreAPIFlag.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 +372,18 @@ 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
+ }
+
+ if api := os.Getenv(SWARM_GLOBALSTORE_API); api != "" {
+ currentConfig.GlobalStoreAPI = api
+ }
+
return currentConfig
}