X-Git-Url: https://git.octo.it/?p=collection4.git;a=blobdiff_plain;f=src%2Fgraph_config.c;h=5d275f0d6b4c4f5a1d8eee79796581078f038471;hp=4f58df0667d0322051cb2067e616038388599b76;hb=bb036145679e3e2db213fd12d46afe4aae31707a;hpb=b988bcc13c655299bc3796cccaa583f62704e759 diff --git a/src/graph_config.c b/src/graph_config.c index 4f58df0..5d275f0 100644 --- a/src/graph_config.c +++ b/src/graph_config.c @@ -34,12 +34,19 @@ #include "graph_list.h" #include "oconfig.h" #include "common.h" +#include "data_provider.h" #ifndef CONFIGFILE # define CONFIGFILE "/etc/collection.conf" #endif -time_t last_read_mtime = 0; +#ifndef CACHEFILE +# define CACHEFILE "/tmp/collection4.json" +#endif + +static time_t last_read_mtime = 0; + +static char *cache_file = NULL; static int dispatch_config (const oconfig_item_t *ci) /* {{{ */ { @@ -52,6 +59,10 @@ static int dispatch_config (const oconfig_item_t *ci) /* {{{ */ child = ci->children + i; if (strcasecmp ("Graph", child->key) == 0) graph_config_add (child); + else if (strcasecmp ("DataProvider", child->key) == 0) + data_provider_config (child); + else if (strcasecmp ("CacheFile", child->key) == 0) + graph_config_get_string (child, &cache_file); else { DEBUG ("Unknown config option: %s", child->key); @@ -139,4 +150,11 @@ int graph_config_get_bool (const oconfig_item_t *ci, /* {{{ */ return (0); } /* }}} int graph_config_get_bool */ +const char *graph_config_get_cache_file (void) /* {{{ */ +{ + if (cache_file == NULL) + return (CACHEFILE); + return (cache_file); +} /* }}} char graph_config_get_cache_file */ + /* vim: set sw=2 sts=2 et fdm=marker : */