This commit is contained in:
Josh Harvey 2016-10-24 01:55:17 +03:00
parent 594228e871
commit defb8d0f34
7 changed files with 36 additions and 53 deletions

View file

@ -28,14 +28,10 @@ module.exports = function (options) {
return configManager.load()
.then(config => {
console.log('DEBUG5: %j', config)
console.log('DEBUG8 ****************')
plugins.configure(config)
console.log('DEBUG9.1 ****************')
plugins.startPolling()
console.log('DEBUG9.2 ****************')
plugins.startCheckingNotification()
console.log('DEBUG9.3 ****************')
app.use(bodyParser.json())
@ -56,12 +52,6 @@ module.exports = function (options) {
server = https.createServer(serverOptions, app)
authMiddleware = function (req, res, next) {
next() // TODO: authentication
}
} else {
server = http.createServer(app)
authMiddleware = function (req, res, next) {
const deviceId = req.connection.getPeerCertificate().fingerprint
@ -76,13 +66,19 @@ module.exports = function (options) {
})
.catch(e => res.status(403).end())
}
} else {
server = http.createServer(app)
authMiddleware = function (req, res, next) {
return next()
}
}
if (options.mock) logger.info('In mock mode')
var localApp = express()
localApp.use(bodyParser.json())
var localServer = http.createServer({localAddress: 'localhost'}, localApp)
var localServer = http.createServer(localApp)
var localPort = 7070
console.log('DEBUG7 ****************')
@ -95,9 +91,9 @@ module.exports = function (options) {
mock: options.mock
})
localServer.listen(7070, function () {
console.log('lamassu-server is listening on local port %d', localPort)
})
// localServer.listen(7070, 'localhost', function () {
// console.log('lamassu-server is listening on local port %d', localPort)
// })
return server
})