Cleanup logging, comments and files

This commit is contained in:
Tobias Reisinger 2020-11-19 18:36:03 +01:00
parent 2fe784dd78
commit 3f11431df6
4 changed files with 4 additions and 7 deletions

2
.gitignore vendored
View file

@ -5,5 +5,7 @@ tests/testing/
include/sql/*.h include/sql/*.h
emgauwa-core.conf.d
emgauwa-core.sqlite emgauwa-core.sqlite
vgcore.* vgcore.*

View file

@ -1,3 +0,0 @@
[core]
not-found-content = "CONF.D WORKING"
not-found-content-type = "text/plain"

View file

@ -24,6 +24,7 @@
#define DEFAULT_CONFIG_PATH "emgauwa-core.conf" #define DEFAULT_CONFIG_PATH "emgauwa-core.conf"
#define DEFAULT_GLOBAL_CONFIG_PATH "/etc/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_DISCOVERY_PORT 4421
#define DEFAULT_MQTT_PORT 1885 #define DEFAULT_MQTT_PORT 1885
#define DEFAULT_SERVER_PORT 5000 #define DEFAULT_SERVER_PORT 5000

View file

@ -200,6 +200,7 @@ config_init()
{ {
global_config = calloc(1, sizeof(config_t)); 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.discovery = DEFAULT_DISCOVERY_PORT;
global_config->ports.mqtt = DEFAULT_MQTT_PORT; global_config->ports.mqtt = DEFAULT_MQTT_PORT;
@ -254,12 +255,10 @@ config_try_file(const char *path)
{ {
if(access(path, F_OK) != 0) if(access(path, F_OK) != 0)
{ {
LOGGER_DEBUG("'%s' does not exist\n", path);
return 1; return 1;
} }
if(access(path, R_OK) != 0) if(access(path, R_OK) != 0)
{ {
LOGGER_DEBUG("no read access for '%s'\n", path);
return 1; return 1;
} }
return 0; return 0;
@ -378,7 +377,5 @@ config_load_directory(config_t *config, const char *directory_name)
free(path); free(path);
} }
// Close directory and exit.
closedir(directory); closedir(directory);
} }