Skip to content

Commit

Permalink
node: Announce version via the attributes
Browse files Browse the repository at this point in the history
It is done automatically but can be overwritten if `Version` attribute is
provided via the application configuration.
Closes nspcc-dev#2455.

Signed-off-by: Pavel Karpy <[email protected]>
  • Loading branch information
carpawell committed Aug 9, 2023
1 parent 95eae6d commit d3ae487
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Changelog for NeoFS Node
- `renew-domain` command for adm
- Stored payload metric per container (#2116)
- Stored payload metric per shard (#2023)
- SN's version is announced via the attributes automatically but can be overwritten explicitly (#2455)

### Fixed
- `neo-go` RPC connection loss handling (#1337)
Expand Down
11 changes: 11 additions & 0 deletions cmd/neofs-node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,11 @@ var persistateSideChainLastBlockKey = []byte("side_chain_last_processed_block")
func initCfg(appCfg *config.Config) *cfg {
c := &cfg{}

// attaching version to the node's attributes; do not
// move it anywhere below reading the other attributes
// since a user should be able to overwrite it.
writeAppVersion(c)

err := c.readConfig(appCfg)
if err != nil {
panic(fmt.Errorf("config reading: %w", err))
Expand Down Expand Up @@ -963,3 +968,9 @@ func (c *cfg) configWatcher(ctx context.Context) {
}
}
}

// writeAppVersion writes app version as defined at compilation
// step to the node's attributes.
func writeAppVersion(c *cfg) {
c.cfgNodeInfo.localInfo.SetAttribute("Version", misc.Version)
}

0 comments on commit d3ae487

Please sign in to comment.