summaryrefslogtreecommitdiffstats
path: root/src/libnetdata/config/appconfig_api_text.c
blob: b314972f0f265be840e6eb26683b81ff238227d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);
}