summaryrefslogtreecommitdiffstats
path: root/src/libnetdata/config/appconfig_api_text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnetdata/config/appconfig_api_text.c')
-rw-r--r--src/libnetdata/config/appconfig_api_text.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libnetdata/config/appconfig_api_text.c b/src/libnetdata/config/appconfig_api_text.c
new file mode 100644
index 000000000..b314972f0
--- /dev/null
+++ b/src/libnetdata/config/appconfig_api_text.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "appconfig_internals.h"
+#include "appconfig_api_text.h"
+
+const char *appconfig_get(struct config *root, const char *section, const char *name, const char *default_value) {
+ struct config_option *opt = appconfig_get_raw_value(root, section, name, default_value, CONFIG_VALUE_TYPE_TEXT, NULL);
+ if(!opt)
+ return default_value;
+
+ return string2str(opt->value);
+}
+
+const char *appconfig_set(struct config *root, const char *section, const char *name, const char *value) {
+ struct config_option *opt = appconfig_set_raw_value(root, section, name, value, CONFIG_VALUE_TYPE_TEXT);
+ return string2str(opt->value);
+}