renamed api config section to web
Costa Tsaousis (ktsaou) committed
Feb 26, 2017 at 01:32 UTC
6fbf1253f08898826fecfa6c1915235b24ffc65d
5 files changed
+28
-28
src/appconfig.c
+1
-1
@@ -525,7 +525,7 @@ void appconfig_generate(struct config *root, BUFFER *wb, int only_changed)
525
appconfig_wrlock(root);
526
for(co = root->sections; co ; co = co->next) {
527
if(!strcmp(co->name, CONFIG_SECTION_GLOBAL)
528
- || !strcmp(co->name, CONFIG_SECTION_API)
528
+ || !strcmp(co->name, CONFIG_SECTION_WEB)
529
|| !strcmp(co->name, CONFIG_SECTION_PLUGINS)
530
|| !strcmp(co->name, CONFIG_SECTION_REGISTRY)
531
|| !strcmp(co->name, CONFIG_SECTION_HEALTH)
src/appconfig.h
+1
-1
@@ -4,7 +4,7 @@
4
#define CONFIG_FILENAME "netdata.conf"
5
6
#define CONFIG_SECTION_GLOBAL "global"
7
-#define CONFIG_SECTION_API "api"
7
+#define CONFIG_SECTION_WEB "web"
8
#define CONFIG_SECTION_PLUGINS "plugins"
9
#define CONFIG_SECTION_REGISTRY "registry"
10
#define CONFIG_SECTION_HEALTH "health"
src/main.c
+20
-20
@@ -60,7 +60,7 @@ struct netdata_static_thread static_threads[] = {
60
};
61
62
void web_server_threading_selection(void) {
63
- web_server_mode = web_server_mode_id(config_get(CONFIG_SECTION_API, "mode", web_server_mode_name(web_server_mode)));
63
+ web_server_mode = web_server_mode_id(config_get(CONFIG_SECTION_WEB, "mode", web_server_mode_name(web_server_mode)));
64
65
int multi_threaded = (web_server_mode == WEB_SERVER_MODE_MULTI_THREADED);
66
int single_threaded = (web_server_mode == WEB_SERVER_MODE_SINGLE_THREADED);
@@ -74,16 +74,16 @@ void web_server_threading_selection(void) {
74
static_threads[i].enabled = single_threaded;
75
}
76
77
- web_client_timeout = (int) config_get_number(CONFIG_SECTION_API, "disconnect idle clients after seconds", DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS);
77
+ web_client_timeout = (int) config_get_number(CONFIG_SECTION_WEB, "disconnect idle clients after seconds", DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS);
78
79
- 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);
80
- web_x_frame_options = config_get(CONFIG_SECTION_API, "x-frame-options response header", "");
79
+ 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);
80
+ web_x_frame_options = config_get(CONFIG_SECTION_WEB, "x-frame-options response header", "");
81
if(!*web_x_frame_options) web_x_frame_options = NULL;
82
83
#ifdef NETDATA_WITH_ZLIB
84
- web_enable_gzip = config_get_boolean(CONFIG_SECTION_API, "enable gzip compression", web_enable_gzip);
84
+ web_enable_gzip = config_get_boolean(CONFIG_SECTION_WEB, "enable gzip compression", web_enable_gzip);
85
86
- char *s = config_get(CONFIG_SECTION_API, "gzip compression strategy", "default");
86
+ char *s = config_get(CONFIG_SECTION_WEB, "gzip compression strategy", "default");
87
if(!strcmp(s, "default"))
88
web_gzip_strategy = Z_DEFAULT_STRATEGY;
89
else if(!strcmp(s, "filtered"))
@@ -99,7 +99,7 @@ void web_server_threading_selection(void) {
99
web_gzip_strategy = Z_DEFAULT_STRATEGY;
100
}
101
102
- web_gzip_level = (int)config_get_number(CONFIG_SECTION_API, "gzip compression level", 3);
102
+ web_gzip_level = (int)config_get_number(CONFIG_SECTION_WEB, "gzip compression level", 3);
103
if(web_gzip_level < 1) {
104
error("Invalid compression level %d. Valid levels are 1 (fastest) to 9 (best ratio). Proceeding with level 1 (fastest compression).", web_gzip_level);
105
web_gzip_level = 1;
@@ -367,40 +367,40 @@ static void backwards_compatible_config() {
367
368
// move [global] options to the [api] section
369
config_move(CONFIG_SECTION_GLOBAL, "bind socket to IP",
370
- CONFIG_SECTION_API, "bind to");
370
+ CONFIG_SECTION_WEB, "bind to");
371
372
config_move(CONFIG_SECTION_GLOBAL, "bind to",
373
- CONFIG_SECTION_API, "bind to");
373
+ CONFIG_SECTION_WEB, "bind to");
374
375
config_move(CONFIG_SECTION_GLOBAL, "port",
376
- CONFIG_SECTION_API, "default port");
376
+ CONFIG_SECTION_WEB, "default port");
377
378
config_move(CONFIG_SECTION_GLOBAL, "default port",
379
- CONFIG_SECTION_API, "default port");
379
+ CONFIG_SECTION_WEB, "default port");
380
381
config_move(CONFIG_SECTION_GLOBAL, "disconnect idle clients after seconds",
382
- CONFIG_SECTION_API, "disconnect idle clients after seconds");
382
+ CONFIG_SECTION_WEB, "disconnect idle clients after seconds");
383
384
config_move(CONFIG_SECTION_GLOBAL, "respect web browser do not track policy",
385
- CONFIG_SECTION_API, "respect do not track policy");
385
+ CONFIG_SECTION_WEB, "respect do not track policy");
386
387
config_move(CONFIG_SECTION_GLOBAL, "web x-frame-options header",
388
- CONFIG_SECTION_API, "x-frame-options response header");
388
+ CONFIG_SECTION_WEB, "x-frame-options response header");
389
390
config_move(CONFIG_SECTION_GLOBAL, "enable web responses gzip compression",
391
- CONFIG_SECTION_API, "enable gzip compression");
391
+ CONFIG_SECTION_WEB, "enable gzip compression");
392
393
config_move(CONFIG_SECTION_GLOBAL, "web compression strategy",
394
- CONFIG_SECTION_API, "gzip compression strategy");
394
+ CONFIG_SECTION_WEB, "gzip compression strategy");
395
396
config_move(CONFIG_SECTION_GLOBAL, "web compression level",
397
- CONFIG_SECTION_API, "gzip compression level");
397
+ CONFIG_SECTION_WEB, "gzip compression level");
398
399
config_move(CONFIG_SECTION_GLOBAL, "web files owner",
400
- CONFIG_SECTION_API, "web files owner");
400
+ CONFIG_SECTION_WEB, "web files owner");
401
402
config_move(CONFIG_SECTION_GLOBAL, "web files group",
403
- CONFIG_SECTION_API, "web files group");
403
+ CONFIG_SECTION_WEB, "web files group");
404
}
405
406
static void get_netdata_configured_variables() {
@@ -592,7 +592,7 @@ int main(int argc, char **argv) {
592
help(0);
593
break;
594
case 'i':
595
- config_set(CONFIG_SECTION_API, "bind to", optarg);
595
+ config_set(CONFIG_SECTION_WEB, "bind to", optarg);
596
break;
597
case 'P':
598
strncpy(pidfile, optarg, FILENAME_MAX);
src/web_client.c
+2
-2
@@ -239,7 +239,7 @@ uid_t web_files_uid(void) {
239
static uid_t owner_uid = 0;
240
241
if(unlikely(!web_owner)) {
242
- web_owner = config_get(CONFIG_SECTION_API, "web files owner", config_get(CONFIG_SECTION_GLOBAL, "run as user", ""));
242
+ web_owner = config_get(CONFIG_SECTION_WEB, "web files owner", config_get(CONFIG_SECTION_GLOBAL, "run as user", ""));
243
if(!web_owner || !*web_owner)
244
owner_uid = geteuid();
245
else {
@@ -266,7 +266,7 @@ gid_t web_files_gid(void) {
266
static gid_t owner_gid = 0;
267
268
if(unlikely(!web_group)) {
269
- web_group = config_get(CONFIG_SECTION_API, "web files group", config_get(CONFIG_SECTION_API, "web files owner", ""));
269
+ web_group = config_get(CONFIG_SECTION_WEB, "web files group", config_get(CONFIG_SECTION_WEB, "web files owner", ""));
270
if(!web_group || !*web_group)
271
owner_gid = getegid();
272
else {
src/web_server.c
+4
-4
@@ -340,16 +340,16 @@ static inline int bind_to_one(const char *definition, int default_port, int list
340
int create_listen_sockets(void) {
341
shown_server_socket_error = 0;
342
343
- listen_backlog = (int) config_get_number(CONFIG_SECTION_API, "listen backlog", LISTEN_BACKLOG);
343
+ listen_backlog = (int) config_get_number(CONFIG_SECTION_WEB, "listen backlog", LISTEN_BACKLOG);
344
345
- listen_port = (int) config_get_number(CONFIG_SECTION_API, "default port", LISTEN_PORT);
345
+ listen_port = (int) config_get_number(CONFIG_SECTION_WEB, "default port", LISTEN_PORT);
346
if(listen_port < 1 || listen_port > 65535) {
347
error("Invalid listen port %d given. Defaulting to %d.", listen_port, LISTEN_PORT);
348
- listen_port = (int) config_set_number(CONFIG_SECTION_API, "default port", LISTEN_PORT);
348
+ listen_port = (int) config_set_number(CONFIG_SECTION_WEB, "default port", LISTEN_PORT);
349
}
350
debug(D_OPTIONS, "Default listen port set to %d.", listen_port);
351
352
- char *s = config_get(CONFIG_SECTION_API, "bind to", "*");
352
+ char *s = config_get(CONFIG_SECTION_WEB, "bind to", "*");
353
while(*s) {
354
char *e = s;
355