Improve config behaviour

This commit is contained in:
Tobias Reisinger 2020-11-19 00:59:26 +01:00
parent 5796f88e05
commit 0c13c03a73
11 changed files with 2571 additions and 37 deletions

View file

@ -3,11 +3,10 @@
typedef struct cli
{
char *config_path;
const char *config_file;
} cli_t;
void
cli_parse(int argc, const char **argv, config_t *config);
cli_parse(int argc, const char **argv, cli_t *cli);
#endif /* CORE_CLI_H */

View file

@ -8,7 +8,6 @@
typedef struct
{
char *file;
char *include;
char *database;
char *user;
@ -46,10 +45,13 @@ config_free();
void
config_load_string(char **holder, const char *value);
int
config_load(config_t *config);
void
config_load(config_t *config, const char *cli_config_file);
void
config_load_directory(config_t *config, char *directory_name);
config_load_file(config_t *config, const char *file_name);
void
config_load_directory(config_t *config, const char *directory_name);
#endif /* CORE_CONFIG_H */

View file

@ -22,7 +22,8 @@
#define PIFACE_GPIO_BASE 200
#define DEFAULT_CONFIG_PATH "emgauwa-core.toml"
#define DEFAULT_CONFIG_PATH "emgauwa-core.conf"
#define DEFAULT_GLOBAL_CONFIG_PATH "/etc/emgauwa/core.conf"
#define DEFAULT_DISCOVERY_PORT 4421
#define DEFAULT_MQTT_PORT 1885
#define DEFAULT_SERVER_PORT 5000