Dmitrii Stepanov
fd28461def
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 3m14s
DCO action / DCO (pull_request) Successful in 3m46s
Build / Build Components (1.21) (pull_request) Successful in 4m20s
Build / Build Components (1.22) (pull_request) Successful in 4m21s
Tests and linters / gopls check (pull_request) Successful in 4m45s
Tests and linters / Lint (pull_request) Successful in 5m16s
Tests and linters / Staticcheck (pull_request) Successful in 6m24s
Pre-commit hooks / Pre-commit (pull_request) Successful in 8m54s
Tests and linters / Tests (1.21) (pull_request) Successful in 10m57s
Tests and linters / Tests with -race (pull_request) Successful in 10m52s
Tests and linters / Tests (1.22) (pull_request) Successful in 11m20s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
132 lines
3.6 KiB
Go
132 lines
3.6 KiB
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func defaultConfiguration(cfg *viper.Viper) {
|
|
cfg.SetDefault("logger.level", "info")
|
|
cfg.SetDefault("logger.destination", "stdout")
|
|
|
|
setPprofDefaults(cfg)
|
|
|
|
setPrometheusDefaults(cfg)
|
|
|
|
cfg.SetDefault("without_mainnet", false)
|
|
|
|
cfg.SetDefault("node.persistent_state.path", ".frostfs-ir-state")
|
|
|
|
setMorphDefaults(cfg)
|
|
|
|
setMainNetDefaults(cfg)
|
|
|
|
setWalletDefaults(cfg)
|
|
|
|
setContractsDefaults(cfg)
|
|
|
|
setTimersDefaults(cfg)
|
|
|
|
setWorkersDefaults(cfg)
|
|
|
|
setNetmapCleanerDefaults(cfg)
|
|
|
|
setEmitDefaults(cfg)
|
|
|
|
cfg.SetDefault("indexer.cache_timeout", 15*time.Second)
|
|
|
|
cfg.SetDefault("locode.db.path", "")
|
|
|
|
setFeeDefaults(cfg)
|
|
|
|
setControlDefaults(cfg)
|
|
|
|
cfg.SetDefault("governance.disable", false)
|
|
|
|
cfg.SetDefault("node.kludge_compatibility_mode", false)
|
|
|
|
cfg.SetDefault("audit.enabled", false)
|
|
}
|
|
|
|
func setControlDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("control.authorized_keys", []string{})
|
|
cfg.SetDefault("control.grpc.endpoint", "")
|
|
}
|
|
|
|
func setFeeDefaults(cfg *viper.Viper) {
|
|
// extra fee values for working mode without notary contract
|
|
cfg.SetDefault("fee.main_chain", 5000_0000) // 0.5 Fixed8
|
|
cfg.SetDefault("fee.side_chain", 2_0000_0000) // 2.0 Fixed8
|
|
}
|
|
|
|
func setEmitDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("emit.storage.amount", 0)
|
|
cfg.SetDefault("emit.mint.cache_size", 1000)
|
|
cfg.SetDefault("emit.mint.threshold", 1)
|
|
cfg.SetDefault("emit.mint.value", 20000000) // 0.2 Fixed8
|
|
cfg.SetDefault("emit.gas.balance_threshold", 0)
|
|
cfg.SetDefault("emit.extra_wallets", nil)
|
|
}
|
|
|
|
func setPprofDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("pprof.address", "localhost:6060")
|
|
cfg.SetDefault("pprof.shutdown_timeout", "30s")
|
|
}
|
|
|
|
func setPrometheusDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("prometheus.address", "localhost:9090")
|
|
cfg.SetDefault("prometheus.shutdown_timeout", "30s")
|
|
}
|
|
|
|
func setNetmapCleanerDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("netmap_cleaner.enabled", true)
|
|
cfg.SetDefault("netmap_cleaner.threshold", 3)
|
|
}
|
|
|
|
func setWorkersDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("workers.netmap", "10")
|
|
cfg.SetDefault("workers.balance", "10")
|
|
cfg.SetDefault("workers.frostfs", "10")
|
|
cfg.SetDefault("workers.container", "10")
|
|
cfg.SetDefault("workers.alphabet", "10")
|
|
}
|
|
|
|
func setTimersDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("timers.emit", "0")
|
|
cfg.SetDefault("timers.stop_estimation.mul", 1)
|
|
cfg.SetDefault("timers.stop_estimation.div", 4)
|
|
cfg.SetDefault("timers.collect_basic_income.mul", 1)
|
|
cfg.SetDefault("timers.collect_basic_income.div", 2)
|
|
cfg.SetDefault("timers.distribute_basic_income.mul", 3)
|
|
cfg.SetDefault("timers.distribute_basic_income.div", 4)
|
|
}
|
|
|
|
func setContractsDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("contracts.netmap", "")
|
|
cfg.SetDefault("contracts.frostfs", "")
|
|
cfg.SetDefault("contracts.balance", "")
|
|
cfg.SetDefault("contracts.container", "")
|
|
cfg.SetDefault("contracts.proxy", "")
|
|
cfg.SetDefault("contracts.processing", "")
|
|
cfg.SetDefault("contracts.proxy", "")
|
|
}
|
|
|
|
func setWalletDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("wallet.path", "") // inner ring node NEP-6 wallet
|
|
cfg.SetDefault("wallet.address", "") // account address
|
|
cfg.SetDefault("wallet.password", "") // password
|
|
}
|
|
|
|
func setMainNetDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("mainnet.endpoint.client", []string{})
|
|
cfg.SetDefault("mainnet.dial_timeout", 15*time.Second)
|
|
cfg.SetDefault("mainnet.switch_interval", 2*time.Minute)
|
|
}
|
|
|
|
func setMorphDefaults(cfg *viper.Viper) {
|
|
cfg.SetDefault("morph.endpoint.client", []string{})
|
|
cfg.SetDefault("morph.dial_timeout", 15*time.Second)
|
|
cfg.SetDefault("morph.validators", []string{})
|
|
cfg.SetDefault("morph.switch_interval", 2*time.Minute)
|
|
}
|