From 3f11431df6e1fae486ee375ab102235516c4755f Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Thu, 19 Nov 2020 18:36:03 +0100 Subject: [PATCH] Cleanup logging, comments and files --- .gitignore | 2 ++ emgauwa-core.conf.d/conf_d_working.conf | 3 --- include/constants.h | 1 + src/config.c | 5 +---- 4 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 emgauwa-core.conf.d/conf_d_working.conf diff --git a/.gitignore b/.gitignore index 3527f78..aae5f18 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,7 @@ tests/testing/ include/sql/*.h +emgauwa-core.conf.d + emgauwa-core.sqlite vgcore.* diff --git a/emgauwa-core.conf.d/conf_d_working.conf b/emgauwa-core.conf.d/conf_d_working.conf deleted file mode 100644 index dc4616a..0000000 --- a/emgauwa-core.conf.d/conf_d_working.conf +++ /dev/null @@ -1,3 +0,0 @@ -[core] -not-found-content = "CONF.D WORKING" -not-found-content-type = "text/plain" diff --git a/include/constants.h b/include/constants.h index d83009b..d92ad15 100644 --- a/include/constants.h +++ b/include/constants.h @@ -24,6 +24,7 @@ #define DEFAULT_CONFIG_PATH "emgauwa-core.conf" #define DEFAULT_GLOBAL_CONFIG_PATH "/etc/emgauwa/core.conf" +#define DEFAULT_DATABASE_PATH "emgauwa-core.sqlite" #define DEFAULT_DISCOVERY_PORT 4421 #define DEFAULT_MQTT_PORT 1885 #define DEFAULT_SERVER_PORT 5000 diff --git a/src/config.c b/src/config.c index 5ad161d..be789c3 100644 --- a/src/config.c +++ b/src/config.c @@ -200,6 +200,7 @@ config_init() { global_config = calloc(1, sizeof(config_t)); + config_load_string(&global_config->database, DEFAULT_DATABASE_PATH); global_config->ports.discovery = DEFAULT_DISCOVERY_PORT; global_config->ports.mqtt = DEFAULT_MQTT_PORT; @@ -254,12 +255,10 @@ config_try_file(const char *path) { if(access(path, F_OK) != 0) { - LOGGER_DEBUG("'%s' does not exist\n", path); return 1; } if(access(path, R_OK) != 0) { - LOGGER_DEBUG("no read access for '%s'\n", path); return 1; } return 0; @@ -378,7 +377,5 @@ config_load_directory(config_t *config, const char *directory_name) free(path); } - // Close directory and exit. - closedir(directory); }