From 1e35c12cc1f706d03813e0b2fb84c07fe5634fe6 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 30 Sep 2022 17:13:16 +0300 Subject: [PATCH] [#1770] node: Validate config before apply it Signed-off-by: Pavel Karpy --- cmd/neofs-node/config.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 6c1eb412..096f8ec8 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -152,15 +152,22 @@ type subStorageCfg struct { // not modifying them. func (a *applicationConfiguration) readConfig(c *config.Config) error { if a._read { - // clear if it is rereading - *a = applicationConfiguration{} - err := c.Reload() if err != nil { - return err + return fmt.Errorf("could not reload configuration: %w", err) } + + err = validateConfig(c) + if err != nil { + return fmt.Errorf("configuration's validation: %w", err) + } + + // clear if it is rereading + *a = applicationConfiguration{} } else { - // update the status + // update the status. + // initial configuration validation is expected to be + // performed on the higher level a._read = true }