diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -5,6 +5,9 @@ #include "log.h" #include <stdlib.h> #include <stdio.h> +#include <libconfig.h> + +config_t cfg; /** * Server entrypoint @@ -12,6 +15,24 @@ * sets up everything needed to handle sockets and connections * */ int main() { + + debug("Initializing config..."); + config_init(&cfg); + if (config_read_file(&cfg, "config.cfg") != CONFIG_TRUE) { + error("Could not read config:"); + printf("%s (%d): %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg)); + + exit(-1); + } + debug("Done"); + + const char* name; + if (!config_lookup_string(&cfg, "name", &name)) { + error("Invalid config"); + exit(-1); + } + + info("Starting up %s game server", name); int err = 0; server_t server = {0}; err = server_listen(&server); |