forked from TrueCloudLab/frostfs-node
[#1770] node: Validate logger config section
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
d7c7022bbd
commit
8c75cb1dad
1 changed files with 13 additions and 0 deletions
|
@ -7,13 +7,26 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
||||||
engineconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine"
|
engineconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine"
|
||||||
shardconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine/shard"
|
shardconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/engine/shard"
|
||||||
|
loggerconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/logger"
|
||||||
treeconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/tree"
|
treeconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/tree"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/blobovniczatree"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/blobovniczatree"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
|
||||||
|
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// validateConfig validates storage node configuration.
|
// validateConfig validates storage node configuration.
|
||||||
func validateConfig(c *config.Config) error {
|
func validateConfig(c *config.Config) error {
|
||||||
|
// logger configuration validation
|
||||||
|
|
||||||
|
var loggerPrm logger.Prm
|
||||||
|
|
||||||
|
err := loggerPrm.SetLevelString(loggerconfig.Level(c))
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("invalid logger level: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// shard configuration validation
|
||||||
|
|
||||||
shardNum := 0
|
shardNum := 0
|
||||||
paths := make(map[string]pathDescription)
|
paths := make(map[string]pathDescription)
|
||||||
return engineconfig.IterateShards(c, false, func(sc *shardconfig.Config) error {
|
return engineconfig.IterateShards(c, false, func(sc *shardconfig.Config) error {
|
||||||
|
|
Loading…
Reference in a new issue