lint cleanup

This commit is contained in:
Josh Harvey 2014-11-20 23:06:14 -05:00
parent e12238c4fe
commit 2c756e231a
8 changed files with 20 additions and 21 deletions

View file

@ -28,6 +28,7 @@ if (!argv.http) {
options.mock = argv.mock;
var server = createServer(options);
server.listen(port, function () {
console.log('lamassu-server listening on port ' + port + ' ' + (argv.http ? '(http)' : '(https)'));
server.listen(port, function() {
console.log('lamassu-server listening on port ' + port + ' ' +
(argv.http ? '(http)' : '(https)'));
});

View file

@ -9,7 +9,7 @@ var plugins = require('./plugins');
var db = require('./postgresql_interface');
var logger = require('./logger');
module.exports = function (options) {
module.exports = function(options) {
var app = express();
var connectionString;
var server;
@ -23,7 +23,7 @@ module.exports = function (options) {
db.init(connectionString);
plugins.init(db);
lamassuConfig.load(function (err, config) {
lamassuConfig.load(function(err, config) {
if (err) {
logger.error('Loading config failed');
throw err;
@ -33,8 +33,8 @@ module.exports = function (options) {
plugins.startPolling();
});
lamassuConfig.on('configUpdate', function () {
lamassuConfig.load(function (err, config) {
lamassuConfig.on('configUpdate', function() {
lamassuConfig.load(function(err, config) {
if (err) {
return logger.error('Error while reloading config');
}
@ -61,7 +61,8 @@ module.exports = function (options) {
server = https.createServer(serverOptions, app);
authMiddleware = function(req, res, next) {
lamassuConfig.isAuthorized(routes.getFingerprint(req), function (err, device) {
lamassuConfig.isAuthorized(routes.getFingerprint(req), function(err,
device) {
if (err) {
res.json({err: 'Internal Server Error'});
return next(err);
@ -77,7 +78,7 @@ module.exports = function (options) {
} else {
server = http.createServer(app);
authMiddleware = function (req, res, next) {
authMiddleware = function(req, res, next) {
req.device = {};
return next();
};

View file

@ -9,12 +9,10 @@ var logLevel = process.env.LAMASSU_ENV === 'debug' ?
var bunyan = bunyan.createLogger({name: 'lamassu-server', level: logLevel});
// log version
var version = require('../package.json').version;
bunyan.info('Version: %s', version);
// log git stuff (optional)
// `git-rev` omits `err` param in callback, without this wrapper
// `async` interprets returned values as errors.
@ -33,7 +31,6 @@ try {
function(err, values) {
bunyan.info('Git: #%s @%s', values[0], values[1]);
});
} catch(_) {}
} catch (_) {}
module.exports = bunyan;

View file

@ -21,7 +21,7 @@ var STALE_BALANCE = 180000;
var cartridges = null;
try {
cartridges = JSON.parse(fs.readFileSync('./cartridges.json'));
} catch(ex) {
} catch (ex) {
logger.warn('No cartridges.json file found: ' + ex.message);
}

View file

@ -2,7 +2,7 @@
var db = require('./db');
exports.up = function(next){
exports.up = function(next) {
var sqls = [
'CREATE TABLE IF NOT EXISTS user_config ( ' +
@ -50,6 +50,6 @@ exports.up = function(next){
db.multi(sqls, next);
};
exports.down = function(next){
exports.down = function(next) {
next();
};

View file

@ -2,7 +2,7 @@
var db = require('./db');
exports.up = function(next){
exports.up = function(next) {
db.query('CREATE TABLE bills ( ' +
'id uuid PRIMARY KEY, ' +
'device_fingerprint text NOT NULL, ' +
@ -15,6 +15,6 @@ exports.up = function(next){
'created timestamp NOT NULL DEFAULT now() )', next);
};
exports.down = function(next){
exports.down = function(next) {
next();
};

View file

@ -2,7 +2,7 @@
var db = require('./db');
exports.up = function(next){
exports.up = function(next) {
db.query('CREATE TABLE machine_events ( ' +
'id uuid PRIMARY KEY, ' +
'device_fingerprint text NOT NULL, ' +
@ -12,6 +12,6 @@ exports.up = function(next){
'created timestamp NOT NULL DEFAULT now() )', next);
};
exports.down = function(next){
exports.down = function(next) {
next();
};

View file

@ -4,7 +4,7 @@ var db = require('./db');
function singleQuotify(item) { return '\'' + item + '\''; }
exports.up = function(next){
exports.up = function(next) {
var stages = ['initial_request', 'partial_request', 'final_request',
'partial_send', 'deposit', 'dispense_request', 'dispense'].
map(singleQuotify).join(',');
@ -61,6 +61,6 @@ exports.up = function(next){
db.multi(sqls, next);
};
exports.down = function(next){
exports.down = function(next) {
next();
};