Fix SN overrided params (#1049)

* Fix SN overrided params

* remove one more override

* fix missing var

* overriding default for storage node

* restore removed code

* fix docker
This commit is contained in:
Michal Niewrzal 2019-01-15 10:43:10 -05:00 committed by GitHub
parent 248ee6438f
commit ab0c18de3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 10 deletions

View File

@ -10,7 +10,7 @@ fi
RUN_PARAMS="${RUN_PARAMS:-} --config-dir ${CONF_PATH}"
export STORJ_IDENTITY_SERVER_ADDRESS="${STORJ_IDENTITY_SERVER_ADDRESS:-$(hostname -i):7777}"
export STORJ_SERVER_ADDRESS="${STORJ_SERVER_ADDRESS:-$(hostname -i):7777}"
if [ -n "${SATELLITE_ADDR:-}" ]; then
RUN_PARAMS="${RUN_PARAMS} --kademlia.bootstrap-addr $SATELLITE_ADDR"

View File

@ -82,6 +82,7 @@ var (
)
const (
// default server address, only for storage node
defaultServerAddr = ":28967"
)
@ -160,15 +161,14 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
}
overrides := map[string]interface{}{
"identity.cert-path": setupCfg.Identity.CertPath,
"identity.key-path": setupCfg.Identity.KeyPath,
"identity.server.address": defaultServerAddr,
"storage.path": filepath.Join(setupDir, "storage"),
"log.level": "info",
"log.level": "info",
}
serverAddress := cmd.Flag("server.address")
if !serverAddress.Changed {
overrides[serverAddress.Name] = defaultServerAddr
}
configFile := filepath.Join(setupDir, "config.yaml")
if setupCfg.SaveAllDefaults {
err = process.SaveConfigWithAllDefaults(cmd.Flags(), configFile, overrides)
} else {

View File

@ -28,7 +28,7 @@ var (
// Config contains everything necessary for a server
type Config struct {
Path string `user:"true" help:"path to store data in" default:"$CONFDIR"`
Path string `user:"true" help:"path to store data in" default:"$CONFDIR/storage"`
AllocatedDiskSpace memory.Size `user:"true" help:"total allocated disk space in bytes" default:"1TiB"`
AllocatedBandwidth memory.Size `user:"true" help:"total allocated bandwidth in bytes" default:"500GiB"`
KBucketRefreshInterval time.Duration `help:"how frequently Kademlia bucket should be refreshed with node stats" default:"1h0m0s"`

View File

@ -83,8 +83,10 @@ func saveConfig(flagset *pflag.FlagSet, outfile string, overrides map[string]int
}
value := f.Value.String()
if v, ok := overrides[k]; ok {
value = fmt.Sprintf("%v", v)
if overrides != nil {
if v, ok := overrides[k]; ok {
value = fmt.Sprintf("%v", v)
}
}
if f.Usage != "" {
fmt.Fprintf(w, "# %s\n", f.Usage)