+ }
+
+ if( Config_ParseFile( config_file ) ) {
+ fprintf(stderr, "NOTICE: Loading of config file '%s' failed, using defaults\n", config_file);
+ }
+
+ // Parse config values
+ {
+ bool rv = true;
+ #define REQ_CFG(variable, type, name) rv = Config_GetValue_##type(name, &variable) && rv
+ #define OPT_CFG(variable, type, name) Config_GetValue_##type(name, &variable)
+ OPT_CFG(gbServer_RunInBackground, Bool, "daemonise");
+ OPT_CFG(giServer_Port, Int, "server_port");
+
+ REQ_CFG(gsCokebankPath, Str, "cokebank_database");
+ REQ_CFG(gsItemListFile, Str, "items_file");
+
+ OPT_CFG(gsDoor_SerialPort, Str, "door_serial_port");
+ REQ_CFG(gsCoke_ModbusAddress, Str, "coke_modbus_address");
+ OPT_CFG(giCoke_ModbusPort, Int, "coke_modbus_port");
+
+ OPT_CFG(gbNoCostMode, Bool, "test_mode");
+ OPT_CFG(gbSyslogEnabled, Bool, "disable_syslog");
+
+ if( !rv ) {
+ fprintf(stderr, "ERROR: Some required configuration items were missing\n");
+ return -1;