diff options
author | George Moschovitis <george.moschovitis@gmail.com> | 2018-12-13 15:30:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-13 15:30:21 +0200 |
commit | 6b05a213029d0097a98e26b6c2aa4ff635f37182 (patch) | |
tree | 7099b599cd7a19916f9cbee882e5012b27b2d1f0 | |
parent | a1690b4978675c3ca995d1ec1613a84a66d2a8c0 (diff) |
Pass cloud_base_url from daemon to web/gui through hello endpoint #4980 (#4982)
* Pass cloud_base_url from daemon to web/gui through hello endpoint #4980
* Make sure the [cloud] section goes into the general part of netdata.conf #4980
-rw-r--r-- | libnetdata/config/appconfig.c | 1 | ||||
-rw-r--r-- | libnetdata/config/appconfig.h | 1 | ||||
-rw-r--r-- | registry/registry.c | 6 | ||||
-rw-r--r-- | registry/registry_init.c | 1 | ||||
-rw-r--r-- | registry/registry_internals.h | 1 | ||||
-rw-r--r-- | web/gui/dashboard.js | 2 | ||||
-rw-r--r-- | web/gui/src/dashboard.js/registry.js | 2 |
7 files changed, 12 insertions, 2 deletions
diff --git a/libnetdata/config/appconfig.c b/libnetdata/config/appconfig.c index 4115384465..9e6a0c02ce 100644 --- a/libnetdata/config/appconfig.c +++ b/libnetdata/config/appconfig.c @@ -538,6 +538,7 @@ void appconfig_generate(struct config *root, BUFFER *wb, int only_changed) || !strcmp(co->name, CONFIG_SECTION_WEB) || !strcmp(co->name, CONFIG_SECTION_STATSD) || !strcmp(co->name, CONFIG_SECTION_PLUGINS) + || !strcmp(co->name, CONFIG_SECTION_CLOUD) || !strcmp(co->name, CONFIG_SECTION_REGISTRY) || !strcmp(co->name, CONFIG_SECTION_HEALTH) || !strcmp(co->name, CONFIG_SECTION_BACKEND) diff --git a/libnetdata/config/appconfig.h b/libnetdata/config/appconfig.h index 6ac666d8b2..78099aad4a 100644 --- a/libnetdata/config/appconfig.h +++ b/libnetdata/config/appconfig.h @@ -86,6 +86,7 @@ #define CONFIG_SECTION_WEB "web" #define CONFIG_SECTION_STATSD "statsd" #define CONFIG_SECTION_PLUGINS "plugins" +#define CONFIG_SECTION_CLOUD "cloud" #define CONFIG_SECTION_REGISTRY "registry" #define CONFIG_SECTION_HEALTH "health" #define CONFIG_SECTION_BACKEND "backend" diff --git a/registry/registry.c b/registry/registry.c index 4f97eb58fd..9a38fcbadb 100644 --- a/registry/registry.c +++ b/registry/registry.c @@ -131,8 +131,10 @@ static inline int registry_person_url_callback_verify_machine_exists(void *entry int registry_request_hello_json(RRDHOST *host, struct web_client *w) { registry_json_header(host, w, "hello", REGISTRY_STATUS_OK); - buffer_sprintf(w->response.data, ",\n\t\"registry\": \"%s\"", - registry.registry_to_announce); + buffer_sprintf(w->response.data, + ",\n\t\"registry\": \"%s\",\n\t\"cloud_base_url\": \"%s\"", + registry.registry_to_announce, + registry.cloud_base_url); registry_json_footer(w); return 200; diff --git a/registry/registry_init.c b/registry/registry_init.c index d3e0420d2c..b8af0ad869 100644 --- a/registry/registry_init.c +++ b/registry/registry_init.c @@ -37,6 +37,7 @@ int registry_init(void) { registry.persons_expiration = config_get_number(CONFIG_SECTION_REGISTRY, "registry expire idle persons days", 365) * 86400; registry.registry_domain = config_get(CONFIG_SECTION_REGISTRY, "registry domain", ""); registry.registry_to_announce = config_get(CONFIG_SECTION_REGISTRY, "registry to announce", "https://registry.my-netdata.io"); + registry.cloud_base_url = config_get(CONFIG_SECTION_CLOUD, "cloud base url", "https://netdata.cloud"); registry.hostname = config_get(CONFIG_SECTION_REGISTRY, "registry hostname", netdata_configured_hostname); registry.verify_cookies_redirects = config_get_boolean(CONFIG_SECTION_REGISTRY, "verify browser cookies support", 1); diff --git a/registry/registry_internals.h b/registry/registry_internals.h index baa2dc09dd..c126e454bd 100644 --- a/registry/registry_internals.h +++ b/registry/registry_internals.h @@ -37,6 +37,7 @@ struct registry { char *registry_domain; char *hostname; char *registry_to_announce; + char *cloud_base_url; time_t persons_expiration; // seconds to expire idle persons int verify_cookies_redirects; diff --git a/web/gui/dashboard.js b/web/gui/dashboard.js index d2f727c6f5..94cdb75e32 100644 --- a/web/gui/dashboard.js +++ b/web/gui/dashboard.js @@ -9677,6 +9677,7 @@ NETDATA.alarms = { NETDATA.registry = { server: null, // the netdata registry server + cloudBaseURL: null, // the netdata cloud base url person_guid: null, // the unique ID of this browser / user machine_guid: null, // the unique ID the netdata server that served dashboard.js hostname: 'unknown', // the hostname of the netdata server that served dashboard.js @@ -9738,6 +9739,7 @@ NETDATA.registry = { NETDATA.registry.hello(NETDATA.serverDefault, function (data) { if (data) { NETDATA.registry.server = data.registry; + NETDATA.registry.cloudBaseURL = data.cloud_base_url; NETDATA.registry.machine_guid = data.machine_guid; NETDATA.registry.hostname = data.hostname; diff --git a/web/gui/src/dashboard.js/registry.js b/web/gui/src/dashboard.js/registry.js index b9d91291ae..b0e893e0cf 100644 --- a/web/gui/src/dashboard.js/registry.js +++ b/web/gui/src/dashboard.js/registry.js @@ -3,6 +3,7 @@ NETDATA.registry = { server: null, // the netdata registry server + cloudBaseURL: null, // the netdata cloud base url person_guid: null, // the unique ID of this browser / user machine_guid: null, // the unique ID the netdata server that served dashboard.js hostname: 'unknown', // the hostname of the netdata server that served dashboard.js @@ -64,6 +65,7 @@ NETDATA.registry = { NETDATA.registry.hello(NETDATA.serverDefault, function (data) { if (data) { NETDATA.registry.server = data.registry; + NETDATA.registry.cloudBaseURL = data.cloud_base_url; NETDATA.registry.machine_guid = data.machine_guid; NETDATA.registry.hostname = data.hostname; |