Adds special keyword 'hide' for masking built-in nodeinfo defaults

This commit is contained in:
Neil Alexander 2018-12-20 23:49:15 +00:00
parent e65910806c
commit 60549cfa09
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -108,9 +108,14 @@ func (m *nodeinfo) setNodeInfo(given interface{}) error {
if nodeinfomap, ok := given.(map[string]interface{}); ok { if nodeinfomap, ok := given.(map[string]interface{}); ok {
for key, value := range nodeinfomap { for key, value := range nodeinfomap {
if _, ok := newnodeinfo[key]; ok { if _, ok := newnodeinfo[key]; ok {
if value == "hide" {
delete(newnodeinfo, key)
}
continue continue
} }
newnodeinfo[key] = value if value != "hide" {
newnodeinfo[key] = value
}
} }
} }
if newjson, err := json.Marshal(newnodeinfo); err == nil { if newjson, err := json.Marshal(newnodeinfo); err == nil {