Skip to content

Commit

Permalink
[nspcc-dev#1770] node: Validate config before apply it
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
  • Loading branch information
carpawell authored and aprasolova committed Oct 19, 2022
1 parent 6acec2b commit eb368ef
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cmd/neofs-node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit eb368ef

Please sign in to comment.