Added a proper check for existing config file

Esse commit está contido em:
Laurent Eschenauer
2013-05-29 21:34:10 +02:00
commit a6df10a63d
+9 -8
Ver Arquivo
@@ -6,9 +6,17 @@ var express = require('express')
, io = require('socket.io').listen(server)
, arDrone = require('ar-drone')
, arDroneConstants = require('ar-drone/lib/constants')
, config = require('./config')
;
// Fetch configuration
try {
var config = require('./config');
} catch (err) {
console.log("Missing or corrupted config file. Have a look at config.js.example if you need an example.");
process.exit(-1);
}
// Override the drone ip using an environment variable,
// using the same convention as node-ar-drone
var drone_ip = process.env.DEFAULT_DRONE_IP || '192.168.1.1';
@@ -42,13 +50,6 @@ app.get('/', function (req, res) {
});
});
/*
* Important:
*
* pass in the server object to listen, not the express app
* call 'listen' on the server, not the express app
*/
function navdata_option_mask(c) {
return 1 << c;
}