Browse Source

gluon-respondd: add system.domain_code to respondd provider "nodeinfo"

[Matthias Schiffer: rebase]
lemoer 6 years ago
parent
commit
2ef0af5fe8
1 changed files with 6 additions and 0 deletions
  1. 6 0
      package/gluon-respondd/src/respondd.c

+ 6 - 0
package/gluon-respondd/src/respondd.c

@@ -67,6 +67,10 @@ static struct json_object * get_site_code(void) {
 	return ret;
 }
 
+static struct json_object * get_domain_code(void) {
+	return gluonutil_wrap_and_free_string(gluonutil_get_domain());
+}
+
 static struct json_object * get_hostname(void) {
 	struct json_object *ret = NULL;
 
@@ -123,6 +127,8 @@ static struct json_object * respondd_provider_nodeinfo(void) {
 
 	struct json_object *system = json_object_new_object();
 	json_object_object_add(system, "site_code", get_site_code());
+	if (gluonutil_has_domains())
+		json_object_object_add(system, "domain_code", get_domain_code());
 	json_object_object_add(ret, "system", system);
 
 	return ret;