2020-07-24 13:54:03 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-03-23 12:44:09 +00:00
|
|
|
"time"
|
2020-07-24 13:54:03 +00:00
|
|
|
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
|
|
|
|
|
|
|
func defaultConfiguration(cfg *viper.Viper) {
|
|
|
|
cfg.SetDefault("logger.level", "info")
|
2024-02-12 10:28:37 +00:00
|
|
|
cfg.SetDefault("logger.destination", "stdout")
|
2024-09-16 07:46:26 +00:00
|
|
|
cfg.SetDefault("logger.timestamp", false)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setPprofDefaults(cfg)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setPrometheusDefaults(cfg)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2021-02-21 09:26:18 +00:00
|
|
|
cfg.SetDefault("without_mainnet", false)
|
|
|
|
|
2022-12-23 17:35:35 +00:00
|
|
|
cfg.SetDefault("node.persistent_state.path", ".frostfs-ir-state")
|
2021-09-06 13:01:50 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setMorphDefaults(cfg)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setMainNetDefaults(cfg)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setWalletDefaults(cfg)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setContractsDefaults(cfg)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setTimersDefaults(cfg)
|
2020-07-24 13:54:03 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setWorkersDefaults(cfg)
|
2020-10-29 16:09:45 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setNetmapCleanerDefaults(cfg)
|
2020-11-03 08:12:39 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
setEmitDefaults(cfg)
|
|
|
|
|
|
|
|
cfg.SetDefault("indexer.cache_timeout", 15*time.Second)
|
|
|
|
|
|
|
|
cfg.SetDefault("locode.db.path", "")
|
|
|
|
|
|
|
|
setFeeDefaults(cfg)
|
|
|
|
|
|
|
|
setControlDefaults(cfg)
|
|
|
|
|
|
|
|
cfg.SetDefault("governance.disable", false)
|
2024-04-04 08:05:25 +00:00
|
|
|
|
|
|
|
cfg.SetDefault("node.kludge_compatibility_mode", false)
|
2024-06-18 09:40:38 +00:00
|
|
|
|
|
|
|
cfg.SetDefault("audit.enabled", false)
|
2023-03-23 13:33:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2023-05-17 14:41:28 +00:00
|
|
|
cfg.SetDefault("fee.main_chain", 5000_0000) // 0.5 Fixed8
|
|
|
|
cfg.SetDefault("fee.side_chain", 2_0000_0000) // 2.0 Fixed8
|
2023-03-23 13:33:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
2021-02-10 07:26:27 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
func setPprofDefaults(cfg *viper.Viper) {
|
|
|
|
cfg.SetDefault("pprof.address", "localhost:6060")
|
|
|
|
cfg.SetDefault("pprof.shutdown_timeout", "30s")
|
|
|
|
}
|
2021-03-23 12:44:09 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
func setPrometheusDefaults(cfg *viper.Viper) {
|
|
|
|
cfg.SetDefault("prometheus.address", "localhost:9090")
|
|
|
|
cfg.SetDefault("prometheus.shutdown_timeout", "30s")
|
|
|
|
}
|
2021-04-29 13:37:16 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
func setNetmapCleanerDefaults(cfg *viper.Viper) {
|
|
|
|
cfg.SetDefault("netmap_cleaner.enabled", true)
|
|
|
|
cfg.SetDefault("netmap_cleaner.threshold", 3)
|
|
|
|
}
|
2021-06-09 15:49:10 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
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")
|
|
|
|
}
|
2021-09-30 08:46:37 +00:00
|
|
|
|
2023-03-23 13:33:54 +00:00
|
|
|
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)
|
2020-07-24 13:54:03 +00:00
|
|
|
}
|