Fix config string handling
This commit is contained in:
parent
b7d3f2ad0b
commit
ead52a0f47
3 changed files with 95 additions and 33 deletions
src
20
src/main.c
20
src/main.c
|
@ -30,6 +30,7 @@ terminate(int signum)
|
|||
router_free();
|
||||
status_free();
|
||||
cache_free();
|
||||
config_free();
|
||||
|
||||
closelog();
|
||||
|
||||
|
@ -56,22 +57,7 @@ main(int argc, const char** argv)
|
|||
|
||||
/******************** LOAD CONFIG ********************/
|
||||
|
||||
global_config.file = "core.ini";
|
||||
global_config.discovery_port = 4421;
|
||||
global_config.mqtt_port = 1885;
|
||||
global_config.server_port = 5000;
|
||||
|
||||
global_config.log_level = LOG_INFO;
|
||||
global_config.log_file = stdout;
|
||||
|
||||
strcpy(global_config.user, "");
|
||||
strcpy(global_config.group, "");
|
||||
|
||||
strcpy(global_config.content_dir, ".");
|
||||
strcpy(global_config.not_found_file, "404.html");
|
||||
strcpy(global_config.not_found_file_type, "text/html");
|
||||
strcpy(global_config.not_found_content, "404 - NOT FOUND");
|
||||
strcpy(global_config.not_found_content_type, "text/plain");
|
||||
config_init();
|
||||
|
||||
helper_parse_cli(argc, argv, &global_config);
|
||||
|
||||
|
@ -81,7 +67,7 @@ main(int argc, const char** argv)
|
|||
LOGGER_CRIT("config file '%s' was not found\n", global_config.file);
|
||||
exit(1);
|
||||
}
|
||||
if(load_ini_file( ini_file, INI_DEFAULT_FORMAT, NULL, config_load, &global_config))
|
||||
if(load_ini_file(ini_file, INI_DEFAULT_FORMAT, NULL, config_load, &global_config))
|
||||
{
|
||||
LOGGER_CRIT("unable to parse ini file\n");
|
||||
exit(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue