X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=config.cpp;h=fad29a5361b7627eb442e0037c2595abcb2a55a7;hp=ec9a0e14dc65eb8debf599ae09ab6fa115b52c05;hb=9abaf929b9da3158e9b7f799775ac56e88d28740;hpb=d1ad2cf60ca694f742e2061a596bc27c7e58f5c8 diff --git a/config.cpp b/config.cpp index ec9a0e1..fad29a5 100644 --- a/config.cpp +++ b/config.cpp @@ -26,7 +26,7 @@ bool read_config(const string &filename, vector *lines) { FILE *fp = fopen(filename.c_str(), "r"); if (fp == NULL) { - perror(filename.c_str()); + log_perror(filename.c_str()); return false; } @@ -269,6 +269,8 @@ bool parse_config(const string &filename, Config *config) return false; } + config->daemonize = false; + if (!fetch_config_int(lines, "num_servers", &config->num_servers)) { log(ERROR, "Missing 'num_servers' statement in config file."); return false; @@ -285,12 +287,15 @@ bool parse_config(const string &filename, Config *config) if (has_stats_interval && !has_stats_file) { log(WARNING, "'stats_interval' given, but no 'stats_file'. No statistics will be written."); } + + fetch_config_string(lines, "access_log", &config->access_log_file); for (size_t i = 0; i < lines.size(); ++i) { const ConfigLine &line = lines[i]; if (line.keyword == "num_servers" || line.keyword == "stats_file" || - line.keyword == "stats_interval") { + line.keyword == "stats_interval" || + line.keyword == "access_log") { // Already taken care of, above. } else if (line.keyword == "port") { if (!parse_port(line, config)) { @@ -304,6 +309,8 @@ bool parse_config(const string &filename, Config *config) if (!parse_error_log(line, config)) { return false; } + } else if (line.keyword == "daemonize") { + config->daemonize = true; } else { log(ERROR, "Unknown configuration keyword '%s'.", line.keyword.c_str());