]> arthur.barton.de Git - netdata.git/commitdiff
renamed api config section to web
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 25 Feb 2017 23:32:28 +0000 (01:32 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 25 Feb 2017 23:32:28 +0000 (01:32 +0200)
src/appconfig.c
src/appconfig.h
src/main.c
src/web_client.c
src/web_server.c

index 2de6f69c085af1f138d45a1db6dc70eb14c6bb61..c628922c2d12bc4b142b7755b66d566a65f6058a 100644 (file)
@@ -525,7 +525,7 @@ void appconfig_generate(struct config *root, BUFFER *wb, int only_changed)
         appconfig_wrlock(root);
         for(co = root->sections; co ; co = co->next) {
             if(!strcmp(co->name, CONFIG_SECTION_GLOBAL)
-               || !strcmp(co->name, CONFIG_SECTION_API)
+               || !strcmp(co->name, CONFIG_SECTION_WEB)
                || !strcmp(co->name, CONFIG_SECTION_PLUGINS)
                || !strcmp(co->name, CONFIG_SECTION_REGISTRY)
                || !strcmp(co->name, CONFIG_SECTION_HEALTH)
index cf41fb3fb17160b3a5e2978d7353033075c6911a..15bba80786e8f5c353183f093d6f91ff378ad7a6 100644 (file)
@@ -4,7 +4,7 @@
 #define CONFIG_FILENAME "netdata.conf"
 
 #define CONFIG_SECTION_GLOBAL   "global"
-#define CONFIG_SECTION_API      "api"
+#define CONFIG_SECTION_WEB      "web"
 #define CONFIG_SECTION_PLUGINS  "plugins"
 #define CONFIG_SECTION_REGISTRY "registry"
 #define CONFIG_SECTION_HEALTH   "health"
index ae8f599aae35a54fb99cd2897e301bdc96074b70..8c157efa38f37f8be81fc52022fee8d3410ed967 100644 (file)
@@ -60,7 +60,7 @@ struct netdata_static_thread static_threads[] = {
 };
 
 void web_server_threading_selection(void) {
-    web_server_mode = web_server_mode_id(config_get(CONFIG_SECTION_API, "mode", web_server_mode_name(web_server_mode)));
+    web_server_mode = web_server_mode_id(config_get(CONFIG_SECTION_WEB, "mode", web_server_mode_name(web_server_mode)));
 
     int multi_threaded = (web_server_mode == WEB_SERVER_MODE_MULTI_THREADED);
     int single_threaded = (web_server_mode == WEB_SERVER_MODE_SINGLE_THREADED);
@@ -74,16 +74,16 @@ void web_server_threading_selection(void) {
             static_threads[i].enabled = single_threaded;
     }
 
-    web_client_timeout = (int) config_get_number(CONFIG_SECTION_API, "disconnect idle clients after seconds", DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS);
+    web_client_timeout = (int) config_get_number(CONFIG_SECTION_WEB, "disconnect idle clients after seconds", DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS);
 
-    respect_web_browser_do_not_track_policy = config_get_boolean(CONFIG_SECTION_API, "respect do not track policy", respect_web_browser_do_not_track_policy);
-    web_x_frame_options = config_get(CONFIG_SECTION_API, "x-frame-options response header", "");
+    respect_web_browser_do_not_track_policy = config_get_boolean(CONFIG_SECTION_WEB, "respect do not track policy", respect_web_browser_do_not_track_policy);
+    web_x_frame_options = config_get(CONFIG_SECTION_WEB, "x-frame-options response header", "");
     if(!*web_x_frame_options) web_x_frame_options = NULL;
 
 #ifdef NETDATA_WITH_ZLIB
-    web_enable_gzip = config_get_boolean(CONFIG_SECTION_API, "enable gzip compression", web_enable_gzip);
+    web_enable_gzip = config_get_boolean(CONFIG_SECTION_WEB, "enable gzip compression", web_enable_gzip);
 
-    char *s = config_get(CONFIG_SECTION_API, "gzip compression strategy", "default");
+    char *s = config_get(CONFIG_SECTION_WEB, "gzip compression strategy", "default");
     if(!strcmp(s, "default"))
         web_gzip_strategy = Z_DEFAULT_STRATEGY;
     else if(!strcmp(s, "filtered"))
@@ -99,7 +99,7 @@ void web_server_threading_selection(void) {
         web_gzip_strategy = Z_DEFAULT_STRATEGY;
     }
 
-    web_gzip_level = (int)config_get_number(CONFIG_SECTION_API, "gzip compression level", 3);
+    web_gzip_level = (int)config_get_number(CONFIG_SECTION_WEB, "gzip compression level", 3);
     if(web_gzip_level < 1) {
         error("Invalid compression level %d. Valid levels are 1 (fastest) to 9 (best ratio). Proceeding with level 1 (fastest compression).", web_gzip_level);
         web_gzip_level = 1;
@@ -367,40 +367,40 @@ static void backwards_compatible_config() {
 
     // move [global] options to the [api] section
     config_move(CONFIG_SECTION_GLOBAL, "bind socket to IP",
-                CONFIG_SECTION_API,    "bind to");
+                CONFIG_SECTION_WEB,    "bind to");
 
     config_move(CONFIG_SECTION_GLOBAL, "bind to",
-                CONFIG_SECTION_API,    "bind to");
+                CONFIG_SECTION_WEB,    "bind to");
 
     config_move(CONFIG_SECTION_GLOBAL, "port",
-                CONFIG_SECTION_API,    "default port");
+                CONFIG_SECTION_WEB,    "default port");
 
     config_move(CONFIG_SECTION_GLOBAL, "default port",
-                CONFIG_SECTION_API,    "default port");
+                CONFIG_SECTION_WEB,    "default port");
 
     config_move(CONFIG_SECTION_GLOBAL, "disconnect idle clients after seconds",
-                CONFIG_SECTION_API,    "disconnect idle clients after seconds");
+                CONFIG_SECTION_WEB,    "disconnect idle clients after seconds");
 
     config_move(CONFIG_SECTION_GLOBAL, "respect web browser do not track policy",
-                CONFIG_SECTION_API,    "respect do not track policy");
+                CONFIG_SECTION_WEB,    "respect do not track policy");
 
     config_move(CONFIG_SECTION_GLOBAL, "web x-frame-options header",
-                CONFIG_SECTION_API,    "x-frame-options response header");
+                CONFIG_SECTION_WEB,    "x-frame-options response header");
 
     config_move(CONFIG_SECTION_GLOBAL, "enable web responses gzip compression",
-                CONFIG_SECTION_API,    "enable gzip compression");
+                CONFIG_SECTION_WEB,    "enable gzip compression");
 
     config_move(CONFIG_SECTION_GLOBAL, "web compression strategy",
-                CONFIG_SECTION_API,    "gzip compression strategy");
+                CONFIG_SECTION_WEB,    "gzip compression strategy");
 
     config_move(CONFIG_SECTION_GLOBAL, "web compression level",
-                CONFIG_SECTION_API,    "gzip compression level");
+                CONFIG_SECTION_WEB,    "gzip compression level");
 
     config_move(CONFIG_SECTION_GLOBAL, "web files owner",
-                CONFIG_SECTION_API,    "web files owner");
+                CONFIG_SECTION_WEB,    "web files owner");
 
     config_move(CONFIG_SECTION_GLOBAL, "web files group",
-                CONFIG_SECTION_API,    "web files group");
+                CONFIG_SECTION_WEB,    "web files group");
 }
 
 static void get_netdata_configured_variables() {
@@ -592,7 +592,7 @@ int main(int argc, char **argv) {
                     help(0);
                     break;
                 case 'i':
-                    config_set(CONFIG_SECTION_API, "bind to", optarg);
+                    config_set(CONFIG_SECTION_WEB, "bind to", optarg);
                     break;
                 case 'P':
                     strncpy(pidfile, optarg, FILENAME_MAX);
index 4fe207ddbd2936007d87294175c86457204213cc..908e72a39a536997b6be22c432785d722d932e4c 100644 (file)
@@ -239,7 +239,7 @@ uid_t web_files_uid(void) {
     static uid_t owner_uid = 0;
 
     if(unlikely(!web_owner)) {
-        web_owner = config_get(CONFIG_SECTION_API, "web files owner", config_get(CONFIG_SECTION_GLOBAL, "run as user", ""));
+        web_owner = config_get(CONFIG_SECTION_WEB, "web files owner", config_get(CONFIG_SECTION_GLOBAL, "run as user", ""));
         if(!web_owner || !*web_owner)
             owner_uid = geteuid();
         else {
@@ -266,7 +266,7 @@ gid_t web_files_gid(void) {
     static gid_t owner_gid = 0;
 
     if(unlikely(!web_group)) {
-        web_group = config_get(CONFIG_SECTION_API, "web files group", config_get(CONFIG_SECTION_API, "web files owner", ""));
+        web_group = config_get(CONFIG_SECTION_WEB, "web files group", config_get(CONFIG_SECTION_WEB, "web files owner", ""));
         if(!web_group || !*web_group)
             owner_gid = getegid();
         else {
index 4a18cc8e6b92965e5997c18c42da9c5891900118..593a82a57f4abfd5a9508130a84cd341d73cee63 100644 (file)
@@ -340,16 +340,16 @@ static inline int bind_to_one(const char *definition, int default_port, int list
 int create_listen_sockets(void) {
     shown_server_socket_error = 0;
 
-    listen_backlog = (int) config_get_number(CONFIG_SECTION_API, "listen backlog", LISTEN_BACKLOG);
+    listen_backlog = (int) config_get_number(CONFIG_SECTION_WEB, "listen backlog", LISTEN_BACKLOG);
 
-    listen_port = (int) config_get_number(CONFIG_SECTION_API, "default port", LISTEN_PORT);
+    listen_port = (int) config_get_number(CONFIG_SECTION_WEB, "default port", LISTEN_PORT);
     if(listen_port < 1 || listen_port > 65535) {
         error("Invalid listen port %d given. Defaulting to %d.", listen_port, LISTEN_PORT);
-        listen_port = (int) config_set_number(CONFIG_SECTION_API, "default port", LISTEN_PORT);
+        listen_port = (int) config_set_number(CONFIG_SECTION_WEB, "default port", LISTEN_PORT);
     }
     debug(D_OPTIONS, "Default listen port set to %d.", listen_port);
 
-    char *s = config_get(CONFIG_SECTION_API, "bind to", "*");
+    char *s = config_get(CONFIG_SECTION_WEB, "bind to", "*");
     while(*s) {
         char *e = s;