Only show build name and version if it is known

This commit is contained in:
Neil Alexander 2018-12-08 11:01:05 +00:00
parent f2d01aa54d
commit 02f98a2592
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 13 additions and 8 deletions

View file

@ -556,13 +556,18 @@ func (a *admin) getData_getSelf() *admin_nodeInfo {
table := a.core.switchTable.table.Load().(lookupTable)
coords := table.self.getCoords()
self := admin_nodeInfo{
{"build_name", GetBuildName()},
{"build_version", GetBuildVersion()},
{"box_pub_key", hex.EncodeToString(a.core.boxPub[:])},
{"ip", a.core.GetAddress().String()},
{"subnet", a.core.GetSubnet().String()},
{"coords", fmt.Sprint(coords)},
}
if name := GetBuildName(); name != "unknown" {
self = append(self, admin_pair{"build_name", name})
}
if version := GetBuildVersion(); version != "unknown" {
self = append(self, admin_pair{"build_version", version})
}
return &self
}

View file

@ -87,11 +87,11 @@ func GetBuildVersion() string {
func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) error {
c.log = log
if buildName != "" {
c.log.Println("Build name:", buildName)
if name := GetBuildName(); name != "unknown" {
c.log.Println("Build name:", name)
}
if buildVersion != "" {
c.log.Println("Build version:", buildVersion)
if version := GetBuildVersion(); version != "unknown" {
c.log.Println("Build version:", version)
}
c.log.Println("Starting up...")