diff options
Diffstat (limited to 'src/exporting/read_config.c')
-rw-r--r-- | src/exporting/read_config.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/exporting/read_config.c b/src/exporting/read_config.c index cd8af6bf6..13fe10883 100644 --- a/src/exporting/read_config.c +++ b/src/exporting/read_config.c @@ -5,11 +5,7 @@ EXPORTING_OPTIONS global_exporting_options = EXPORTING_SOURCE_DATA_AVERAGE | EXPORTING_OPTION_SEND_NAMES; const char *global_exporting_prefix = "netdata"; -struct config exporting_config = { .first_section = NULL, - .last_section = NULL, - .mutex = NETDATA_MUTEX_INITIALIZER, - .index = { .avl_tree = { .root = NULL, .compar = appconfig_section_compare }, - .rwlock = AVL_LOCK_INITIALIZER } }; +struct config exporting_config = APPCONFIG_INITIALIZER; struct instance *prometheus_exporter_instance = NULL; @@ -32,7 +28,7 @@ static _CONNECTOR_INSTANCE *find_instance(const char *section) return local_ci; } -char *expconfig_get(struct config *root, const char *section, const char *name, const char *default_value) +static const char *expconfig_get(struct config *root, const char *section, const char *name, const char *default_value) { _CONNECTOR_INSTANCE *local_ci; @@ -207,14 +203,14 @@ struct engine *read_exporting_config() if (unlikely(engine)) return engine; - char *filename = strdupz_path_subpath(netdata_configured_user_config_dir, EXPORTING_CONF); + char *filename = filename_from_path_entry_strdupz(netdata_configured_user_config_dir, EXPORTING_CONF); exporting_config_exists = appconfig_load(&exporting_config, filename, 0, NULL); if (!exporting_config_exists) { netdata_log_info("CONFIG: cannot load user exporting config '%s'. Will try the stock version.", filename); freez(filename); - filename = strdupz_path_subpath(netdata_configured_stock_config_dir, EXPORTING_CONF); + filename = filename_from_path_entry_strdupz(netdata_configured_stock_config_dir, EXPORTING_CONF); exporting_config_exists = appconfig_load(&exporting_config, filename, 0, NULL); if (!exporting_config_exists) netdata_log_info("CONFIG: cannot load stock exporting config '%s'. Running with internal defaults.", filename); @@ -243,7 +239,7 @@ struct engine *read_exporting_config() prometheus_exporter_instance->config.options |= global_exporting_options & EXPORTING_OPTIONS_SOURCE_BITS; - char *data_source = prometheus_config_get("data source", "average"); + const char *data_source = prometheus_config_get("data source", "average"); prometheus_exporter_instance->config.options = exporting_parse_data_source(data_source, prometheus_exporter_instance->config.options); @@ -378,7 +374,7 @@ struct engine *read_exporting_config() tmp_instance->config.hosts_pattern = simple_pattern_create( exporter_get(instance_name, "send hosts matching", "localhost *"), NULL, SIMPLE_PATTERN_EXACT, true); - char *data_source = exporter_get(instance_name, "data source", "average"); + const char *data_source = exporter_get(instance_name, "data source", "average"); tmp_instance->config.options = exporting_parse_data_source(data_source, tmp_instance->config.options); if (EXPORTING_OPTIONS_DATA_SOURCE(tmp_instance->config.options) != EXPORTING_SOURCE_DATA_AS_COLLECTED && @@ -468,8 +464,6 @@ struct engine *read_exporting_config() tmp_instance->config.hostname = strdupz(exporter_get(instance_name, "hostname", engine->config.hostname)); -#ifdef ENABLE_HTTPS - #define STR_GRAPHITE_HTTPS "graphite:https" #define STR_JSON_HTTPS "json:https" #define STR_OPENTSDB_HTTPS "opentsdb:https" @@ -487,7 +481,6 @@ struct engine *read_exporting_config() strlen(STR_PROMETHEUS_REMOTE_WRITE_HTTPS)))) { tmp_instance->config.options |= EXPORTING_OPTION_USE_TLS; } -#endif #ifdef NETDATA_INTERNAL_CHECKS netdata_log_info( |