Replace ini with toml

This commit is contained in:
Tobias Reisinger 2020-11-17 23:13:01 +01:00
parent 97a19135ce
commit 5796f88e05
11 changed files with 242 additions and 5726 deletions

View file

@ -4,7 +4,7 @@
#include <stdint.h>
#include <mongoose.h>
#include <confini.h>
#include <toml.h>
typedef struct
{
@ -13,16 +13,25 @@ typedef struct
char *database;
char *user;
char *group;
int log_level;
FILE *log_file;
uint16_t server_port;
uint16_t discovery_port;
uint16_t mqtt_port;
char *content_dir;
char *not_found_file;
char *not_found_file_type;
char *not_found_content;
char *not_found_content_type;
struct
{
int level;
FILE *file;
} logging;
struct
{
uint16_t server;
uint16_t discovery;
uint16_t mqtt;
} ports;
struct mg_serve_http_opts http_server_opts;
} config_t;
@ -38,6 +47,9 @@ void
config_load_string(char **holder, const char *value);
int
config_load(IniDispatch *disp, void *config_void);
config_load(config_t *config);
void
config_load_directory(config_t *config, char *directory_name);
#endif /* CORE_CONFIG_H */

View file

@ -22,7 +22,7 @@
#define PIFACE_GPIO_BASE 200
#define DEFAULT_CONFIG_PATH "emgauwa-core.ini"
#define DEFAULT_CONFIG_PATH "emgauwa-core.toml"
#define DEFAULT_DISCOVERY_PORT 4421
#define DEFAULT_MQTT_PORT 1885
#define DEFAULT_SERVER_PORT 5000