core-legacy/include/config.h

58 lines
948 B
C
Raw Permalink Normal View History

2020-05-05 09:42:02 +00:00
#ifndef CORE_CONFIG_H
#define CORE_CONFIG_H
#include <stdint.h>
2020-05-31 00:07:25 +00:00
#include <mongoose.h>
2020-11-17 22:13:01 +00:00
#include <toml.h>
2020-05-05 09:42:02 +00:00
typedef struct
{
2020-11-04 22:03:33 +00:00
char *include;
char *database;
char *user;
char *group;
char *content_dir;
char *not_found_file;
char *not_found_file_type;
char *not_found_content;
char *not_found_content_type;
2020-11-17 22:13:01 +00:00
struct
{
int level;
FILE *file;
} logging;
struct
{
uint16_t server;
uint16_t discovery;
uint16_t mqtt;
} ports;
2020-05-31 00:07:25 +00:00
struct mg_serve_http_opts http_server_opts;
2020-05-05 09:42:02 +00:00
} config_t;
2020-11-12 20:58:01 +00:00
extern config_t *global_config;
2020-05-05 09:42:02 +00:00
2020-11-04 22:03:33 +00:00
void
config_init();
void
config_free();
void
2020-11-12 20:58:01 +00:00
config_load_string(char **holder, const char *value);
2020-11-04 22:03:33 +00:00
2020-11-18 23:59:26 +00:00
void
config_load(config_t *config, const char *cli_config_file);
void
config_load_file(config_t *config, const char *file_name);
2020-11-17 22:13:01 +00:00
void
2020-11-18 23:59:26 +00:00
config_load_directory(config_t *config, const char *directory_name);
2020-05-05 09:42:02 +00:00
#endif /* CORE_CONFIG_H */