From bb1e952e39994eaaaa4d24bff38f5b1bd3a3ddc4 Mon Sep 17 00:00:00 2001 From: Josh Harvey Date: Mon, 24 Oct 2016 23:05:04 +0300 Subject: [PATCH] WIP --- bin/lamassu-server | 1 - lib/app.js | 2 +- lib/db.js | 2 +- lib/postgresql_interface.js | 3 ++- lib/routes.js | 1 - 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/lamassu-server b/bin/lamassu-server index 53879f8e..0fa31408 100755 --- a/bin/lamassu-server +++ b/bin/lamassu-server @@ -17,7 +17,6 @@ if (!httpOnly) { options.https = { key: fs.readFileSync(options.certKeyPath), cert: fs.readFileSync(options.certPath), - requestCert: true } } catch (err) { console.log('Please configure your certificate.') diff --git a/lib/app.js b/lib/app.js index 90bb18d5..c25e116e 100644 --- a/lib/app.js +++ b/lib/app.js @@ -41,7 +41,7 @@ module.exports = function (options) { var authMiddleware if (options.https) { - var serverOptions = { + const serverOptions = { key: options.https.key, cert: options.https.cert, requestCert: true diff --git a/lib/db.js b/lib/db.js index 2889018d..6523e2d4 100644 --- a/lib/db.js +++ b/lib/db.js @@ -1,4 +1,4 @@ const pgp = require('pg-promise')() const psqlUrl = require('../lib/options').postgresql -module.exports = {db: pgp(psqlUrl)} +module.exports = pgp(psqlUrl) diff --git a/lib/postgresql_interface.js b/lib/postgresql_interface.js index 4849a6d9..bf12d0a5 100644 --- a/lib/postgresql_interface.js +++ b/lib/postgresql_interface.js @@ -261,7 +261,8 @@ exports.cartridgeCounts = function cartridgeCounts (deviceId) { return db.oneOrNone(sql, [deviceId, true]) .then(row => { const counts = row ? [row.count1, row.count2] : [0, 0] - return {id: row.id, counts: counts} + const id = row ? row.id : 0 + return {id, counts} }) } diff --git a/lib/routes.js b/lib/routes.js index 43ef06b5..b5252473 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -56,7 +56,6 @@ function buildBalances (deviceId) { } function poll (req, res) { - console.log('DEBUG1') const deviceId = getDeviceId(req) const deviceTime = getDeviceTime(req) const pid = req.query.pid