mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-25 09:31:34 +00:00
Adds special keyword 'hide' for masking built-in nodeinfo defaults
This commit is contained in:
parent
e65910806c
commit
60549cfa09
@ -108,11 +108,16 @@ 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
|
||||||
}
|
}
|
||||||
|
if value != "hide" {
|
||||||
newnodeinfo[key] = value
|
newnodeinfo[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if newjson, err := json.Marshal(newnodeinfo); err == nil {
|
if newjson, err := json.Marshal(newnodeinfo); err == nil {
|
||||||
if len(newjson) > 16384 {
|
if len(newjson) > 16384 {
|
||||||
return errors.New("NodeInfo exceeds max length of 16384 bytes")
|
return errors.New("NodeInfo exceeds max length of 16384 bytes")
|
||||||
|
Loading…
Reference in New Issue
Block a user