From e50abeab0cd266e28cbdbd1c92b1329c8dfb02b9 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 9 Jun 2021 14:00:55 +0300 Subject: [PATCH] [#598] innerring/config: Override global config only in debug build Signed-off-by: Alex Vanin --- pkg/innerring/config/config.go | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/pkg/innerring/config/config.go b/pkg/innerring/config/config.go index 73c0aed1b5..dcfbe65c6b 100644 --- a/pkg/innerring/config/config.go +++ b/pkg/innerring/config/config.go @@ -13,6 +13,7 @@ Implemented as a part of https://github.com/nspcc-dev/neofs-node/issues/363 */ import ( + "github.com/nspcc-dev/neofs-node/misc" netmapClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" "github.com/spf13/viper" ) @@ -30,27 +31,33 @@ func NewGlobalConfigReader(cfg *viper.Viper, nm *netmapClient.Wrapper) *GlobalCo } func (c *GlobalConfig) BasicIncomeRate() (uint64, error) { - value := c.cfg.GetUint64("settlement.basic_income_rate") - if value != 0 { - return value, nil + if isDebug() { + value := c.cfg.GetUint64("settlement.basic_income_rate") + if value != 0 { + return value, nil + } } return c.nm.BasicIncomeRate() } func (c *GlobalConfig) AuditFee() (uint64, error) { - value := c.cfg.GetUint64("settlement.audit_fee") - if value != 0 { - return value, nil + if isDebug() { + value := c.cfg.GetUint64("settlement.audit_fee") + if value != 0 { + return value, nil + } } return c.nm.AuditFee() } func (c *GlobalConfig) EpochDuration() (uint32, error) { - value := c.cfg.GetUint32("timers.epoch") - if value != 0 { - return value, nil + if isDebug() { + value := c.cfg.GetUint32("timers.epoch") + if value != 0 { + return value, nil + } } epochDuration, err := c.nm.EpochDuration() @@ -60,3 +67,7 @@ func (c *GlobalConfig) EpochDuration() (uint32, error) { return uint32(epochDuration), nil } + +func isDebug() bool { + return misc.Debug == "true" +}