feat: add new server log page

This commit is contained in:
Luis Félix 2019-11-12 11:15:00 +00:00
parent fc1951c4b2
commit 703c5d7c91
38 changed files with 2844 additions and 29 deletions

View file

@ -7,7 +7,9 @@ const got = require('got')
const supportLogs = require('../support_logs')
const machineLoader = require('../machine-loader')
const logs = require('../logs')
const serverLogs = require('./server-logs')
const supervisor = require('./supervisor')
const funding = require('./funding')
const config = require('./config')
@ -56,6 +58,28 @@ app.post('/api/support_logs', (req, res, next) => {
.catch(next)
})
app.get('/api/version', (req, res, next) => {
res.send(require('../../package.json').version)
})
app.get('/api/uptimes', (req, res, next) => {
return supervisor.getAllProcessInfo()
.then(r => res.send(r))
.catch(next)
})
app.post('/api/server_support_logs', (req, res, next) => {
return serverLogs.insert()
.then(r => res.send(r))
.catch(next)
})
app.get('/api/server_logs', (req, res, next) => {
return serverLogs.getServerLogs()
.then(r => res.send(r))
.catch(next)
})
function dbNotify () {
return got.post('http://localhost:3030/dbChange')
.catch(e => console.error('Error: lamassu-server not responding'))