2020-07-24 13:54:03 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/misc"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
|
|
|
|
|
|
|
func newConfig(path string) (*viper.Viper, error) {
|
|
|
|
var (
|
|
|
|
err error
|
|
|
|
v = viper.New()
|
|
|
|
)
|
|
|
|
|
|
|
|
v.SetEnvPrefix(misc.InnerRingPrefix)
|
|
|
|
v.AutomaticEnv()
|
|
|
|
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
|
|
|
|
|
|
|
v.SetDefault("app.name", misc.InnerRingName)
|
|
|
|
v.SetDefault("app.version", misc.Version)
|
|
|
|
|
|
|
|
defaultConfiguration(v)
|
|
|
|
|
|
|
|
if path != "" {
|
|
|
|
v.SetConfigFile(path)
|
|
|
|
v.SetConfigType("yml") // fixme: for now
|
|
|
|
err = v.ReadInConfig()
|
|
|
|
}
|
|
|
|
|
|
|
|
return v, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func defaultConfiguration(cfg *viper.Viper) {
|
|
|
|
cfg.SetDefault("logger.level", "info")
|
|
|
|
cfg.SetDefault("logger.format", "console")
|
|
|
|
cfg.SetDefault("logger.trace_level", "fatal")
|
|
|
|
cfg.SetDefault("logger.no_disclaimer", false)
|
|
|
|
cfg.SetDefault("logger.sampling.initial", 1000)
|
|
|
|
cfg.SetDefault("logger.sampling.thereafter", 1000)
|
|
|
|
|
|
|
|
cfg.SetDefault("pprof.enabled", false)
|
|
|
|
cfg.SetDefault("pprof.address", ":6060")
|
|
|
|
cfg.SetDefault("pprof.shutdown_ttl", "30s")
|
|
|
|
|
|
|
|
cfg.SetDefault("metrics.enabled", false)
|
|
|
|
cfg.SetDefault("metrics.address", ":9090")
|
|
|
|
cfg.SetDefault("metrics.shutdown_ttl", "30s")
|
|
|
|
|
2021-02-21 09:26:18 +00:00
|
|
|
cfg.SetDefault("without_mainnet", false)
|
|
|
|
|
2020-07-24 13:54:03 +00:00
|
|
|
cfg.SetDefault("morph.endpoint.client", "")
|
|
|
|
cfg.SetDefault("morph.endpoint.notification", "")
|
|
|
|
cfg.SetDefault("morph.dial_timeout", "10s")
|
2020-11-13 11:47:23 +00:00
|
|
|
cfg.SetDefault("morph.validators", []string{})
|
2020-07-24 13:54:03 +00:00
|
|
|
|
|
|
|
cfg.SetDefault("mainnet.endpoint.client", "")
|
|
|
|
cfg.SetDefault("mainnet.endpoint.notification", "")
|
|
|
|
cfg.SetDefault("mainnet.dial_timeout", "10s")
|
|
|
|
|
|
|
|
cfg.SetDefault("key", "") // inner ring node key
|
|
|
|
|
|
|
|
cfg.SetDefault("contracts.netmap", "")
|
|
|
|
cfg.SetDefault("contracts.neofs", "")
|
|
|
|
cfg.SetDefault("contracts.balance", "")
|
2020-08-11 12:14:08 +00:00
|
|
|
cfg.SetDefault("contracts.container", "")
|
2020-12-18 09:27:19 +00:00
|
|
|
cfg.SetDefault("contracts.audit", "")
|
2021-02-20 10:44:51 +00:00
|
|
|
cfg.SetDefault("contracts.proxy", "")
|
2020-10-12 09:29:27 +00:00
|
|
|
// alphabet contracts
|
2021-02-21 08:49:57 +00:00
|
|
|
cfg.SetDefault("contracts.alphabet.amount", 7)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2021-01-22 15:01:44 +00:00
|
|
|
cfg.SetDefault("timers.epoch", "0")
|
2021-01-22 15:49:52 +00:00
|
|
|
cfg.SetDefault("timers.emit", "0")
|
2021-02-24 15:46:01 +00:00
|
|
|
cfg.SetDefault("timers.notary", "1000")
|
2021-01-29 07:48:47 +00:00
|
|
|
cfg.SetDefault("timers.stop_estimation.mul", 1)
|
|
|
|
cfg.SetDefault("timers.stop_estimation.div", 1)
|
2021-02-01 16:20:33 +00:00
|
|
|
cfg.SetDefault("timers.collect_basic_income.mul", 1)
|
|
|
|
cfg.SetDefault("timers.collect_basic_income.div", 1)
|
2021-02-02 14:17:51 +00:00
|
|
|
cfg.SetDefault("timers.distribute_basic_income.mul", 1)
|
|
|
|
cfg.SetDefault("timers.distribute_basic_income.div", 1)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2021-02-24 15:46:01 +00:00
|
|
|
cfg.SetDefault("notary.deposit_amount", 1_0000_0000) // 1.0 Fixed8
|
|
|
|
|
2020-07-24 13:54:03 +00:00
|
|
|
cfg.SetDefault("workers.netmap", "10")
|
|
|
|
cfg.SetDefault("workers.balance", "10")
|
|
|
|
cfg.SetDefault("workers.neofs", "10")
|
2020-08-11 12:14:08 +00:00
|
|
|
cfg.SetDefault("workers.container", "10")
|
2020-10-12 10:17:40 +00:00
|
|
|
cfg.SetDefault("workers.alphabet", "10")
|
2020-10-29 16:09:45 +00:00
|
|
|
|
|
|
|
cfg.SetDefault("netmap_cleaner.enabled", false)
|
|
|
|
cfg.SetDefault("netmap_cleaner.threshold", 3)
|
2020-11-03 08:12:39 +00:00
|
|
|
|
|
|
|
cfg.SetDefault("emit.storage.amount", 0)
|
2020-11-03 11:16:32 +00:00
|
|
|
cfg.SetDefault("emit.mint.cache_size", 1000)
|
|
|
|
cfg.SetDefault("emit.mint.threshold", 1)
|
|
|
|
cfg.SetDefault("emit.mint.value", 20000000) // 0.2 Fixed8
|
2021-03-18 17:42:35 +00:00
|
|
|
cfg.SetDefault("emit.gas.balance_threshold", 0)
|
2020-12-22 11:47:13 +00:00
|
|
|
|
|
|
|
cfg.SetDefault("audit.task.exec_pool_size", 10)
|
|
|
|
cfg.SetDefault("audit.task.queue_capacity", 100)
|
2020-12-23 08:44:29 +00:00
|
|
|
cfg.SetDefault("audit.timeout.get", "5s")
|
|
|
|
cfg.SetDefault("audit.timeout.head", "5s")
|
|
|
|
cfg.SetDefault("audit.timeout.rangehash", "5s")
|
2020-12-23 15:07:10 +00:00
|
|
|
cfg.SetDefault("audit.timeout.search", "10s")
|
2020-12-23 16:53:11 +00:00
|
|
|
cfg.SetDefault("audit.pdp.max_sleep_interval", "5s")
|
|
|
|
cfg.SetDefault("audit.pdp.pairs_pool_size", "10")
|
2020-12-25 07:45:59 +00:00
|
|
|
cfg.SetDefault("audit.por.pool_size", "10")
|
2021-02-02 11:12:41 +00:00
|
|
|
|
|
|
|
cfg.SetDefault("settlement.basic_income_rate", 0)
|
2021-02-10 07:26:27 +00:00
|
|
|
|
|
|
|
cfg.SetDefault("locode.db.path", "")
|
2020-07-24 13:54:03 +00:00
|
|
|
}
|