[#877] config/engine: use default section for shards

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-10-18 16:38:04 +03:00 committed by Alex Vanin
parent cb9bf00ceb
commit 49c9dbfba8
3 changed files with 32 additions and 39 deletions

View file

@ -22,8 +22,6 @@ func (x *Config) Sub(name string) *Config {
copy(defaultPath, x.defaultPath)
}
copy(path, x.path)
return &Config{
v: x.v,
path: append(path, name),

View file

@ -28,6 +28,7 @@ func IterateShards(c *config.Config, f func(*shardconfig.Config)) {
panic("no shard configured")
}
def := c.Sub("default")
c = c.Sub("shard")
for i := uint64(0); i < num; i++ {
@ -36,6 +37,7 @@ func IterateShards(c *config.Config, f func(*shardconfig.Config)) {
sc := shardconfig.From(
c.Sub(si),
)
(*config.Config)(sc).SetDefault(def)
f(sc)
}