configuration nodes are prioritized
Costa Tsaousis (ktsaou) committed
Apr 27, 2014 at 18:46 UTC
02df7ef86964ae26b123bafbb2446f59a248e6af
1 file changed
+18
-9
netdata.c
+18
-9
@@ -1695,20 +1695,29 @@ unsigned long rrd_stats_json(int type, RRD_STATS *st, struct web_buffer *wb, siz
1695
1696
void generate_config(struct web_buffer *wb)
1697
{
1698
+ int i, pri;
1699
struct config *co;
1700
struct config_value *cv;
1701
1701
- for(co = config_root; co ; co = co->next) {
1702
- web_buffer_increase(wb, CONFIG_MAX_NAME + 4);
1703
- web_buffer_printf(wb, "\n[%s]\n", co->name);
1702
+ for(i = 0; i < 3 ;i++) {
1703
+ for(co = config_root; co ; co = co->next) {
1704
+ if(strcmp(co->name, "global") == 0 || strcmp(co->name, "debug") == 0 || strcmp(co->name, "plugins") == 0) pri = 0;
1705
+ else if(strncmp(co->name, "plugin:", 7) == 0) pri = 1;
1706
+ else pri = 2;
1707
1705
- for(cv = co->values; cv ; cv = cv->next) {
1706
- if(!cv->used) {
1707
- web_buffer_increase(wb, CONFIG_MAX_NAME + 200);
1708
- web_buffer_printf(wb, "\t# the option '%s' is not used, you can remove it\n", cv->name);
1708
+ if(i == pri) {
1709
+ web_buffer_increase(wb, CONFIG_MAX_NAME + 4);
1710
+ web_buffer_printf(wb, "\n[%s]\n", co->name);
1711
+
1712
+ for(cv = co->values; cv ; cv = cv->next) {
1713
+ if(!cv->used) {
1714
+ web_buffer_increase(wb, CONFIG_MAX_NAME + 200);
1715
+ web_buffer_printf(wb, "\t# the option '%s' is not used, you can remove it\n", cv->name);
1716
+ }
1717
+ web_buffer_increase(wb, CONFIG_MAX_NAME + CONFIG_MAX_VALUE + 5);
1718
+ web_buffer_printf(wb, "\t%s = %s\n", cv->name, cv->value);
1719
+ }
1720
}
1710
- web_buffer_increase(wb, CONFIG_MAX_NAME + CONFIG_MAX_VALUE + 5);
1711
- web_buffer_printf(wb, "\t%s = %s\n", cv->name, cv->value);
1721
}
1722
}
1723
}