[#222] Add shard amount check

There should be at least one correctly set up shard in node config.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-01 17:57:37 +03:00
parent 6bec50963b
commit 4114028a63

View file

@ -449,6 +449,7 @@ func initShardOptions(c *cfg) {
configPath(writeCachePrefix, cfgBlobStorTreePath),
)
if useCache && writeCachePath == "" {
c.log.Warn("incorrect writeCache path, ignore shard")
break
}
@ -458,6 +459,7 @@ func initShardOptions(c *cfg) {
configPath(blobPrefix, cfgBlobStorTreePath),
)
if blobPath == "" {
c.log.Warn("incorrect blobStor path, ignore shard")
break
}
@ -545,6 +547,10 @@ func initShardOptions(c *cfg) {
)
}
if len(opts) == 0 {
fatalOnErr(errors.New("no correctly set up shards, exit"))
}
c.cfgObject.cfgLocalStorage.shardOpts = opts
}