feat: add labels to NodeInfo
This commit is contained in:
@@ -118,6 +118,16 @@ void ClusterManager::fetchNodeInfo(const IPAddress& ip) {
|
||||
node.apiEndpoints.push_back(std::make_tuple(uri, method));
|
||||
}
|
||||
}
|
||||
// Parse labels if present
|
||||
node.labels.clear();
|
||||
if (doc["labels"].is<JsonObject>()) {
|
||||
JsonObject labelsObj = doc["labels"].as<JsonObject>();
|
||||
for (JsonPair kvp : labelsObj) {
|
||||
String k = String(kvp.key().c_str());
|
||||
String v = String(labelsObj[kvp.key()]);
|
||||
node.labels[k] = v;
|
||||
}
|
||||
}
|
||||
Serial.printf("[Cluster] Fetched info for node: %s @ %s\n", node.hostname.c_str(), ip.toString().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user