This commit is contained in:
Josh Harvey 2016-10-24 23:05:04 +03:00
parent a49fac6cc8
commit bb1e952e39
5 changed files with 4 additions and 5 deletions

View file

@ -17,7 +17,6 @@ if (!httpOnly) {
options.https = { options.https = {
key: fs.readFileSync(options.certKeyPath), key: fs.readFileSync(options.certKeyPath),
cert: fs.readFileSync(options.certPath), cert: fs.readFileSync(options.certPath),
requestCert: true
} }
} catch (err) { } catch (err) {
console.log('Please configure your certificate.') console.log('Please configure your certificate.')

View file

@ -41,7 +41,7 @@ module.exports = function (options) {
var authMiddleware var authMiddleware
if (options.https) { if (options.https) {
var serverOptions = { const serverOptions = {
key: options.https.key, key: options.https.key,
cert: options.https.cert, cert: options.https.cert,
requestCert: true requestCert: true

View file

@ -1,4 +1,4 @@
const pgp = require('pg-promise')() const pgp = require('pg-promise')()
const psqlUrl = require('../lib/options').postgresql const psqlUrl = require('../lib/options').postgresql
module.exports = {db: pgp(psqlUrl)} module.exports = pgp(psqlUrl)

View file

@ -261,7 +261,8 @@ exports.cartridgeCounts = function cartridgeCounts (deviceId) {
return db.oneOrNone(sql, [deviceId, true]) return db.oneOrNone(sql, [deviceId, true])
.then(row => { .then(row => {
const counts = row ? [row.count1, row.count2] : [0, 0] const counts = row ? [row.count1, row.count2] : [0, 0]
return {id: row.id, counts: counts} const id = row ? row.id : 0
return {id, counts}
}) })
} }

View file

@ -56,7 +56,6 @@ function buildBalances (deviceId) {
} }
function poll (req, res) { function poll (req, res) {
console.log('DEBUG1')
const deviceId = getDeviceId(req) const deviceId = getDeviceId(req)
const deviceTime = getDeviceTime(req) const deviceTime = getDeviceTime(req)
const pid = req.query.pid const pid = req.query.pid