mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
Health check should verify that it can talk to the toggle-store (aka DB).
This commit fixes #103 by doing a simple select against the features table.
This commit is contained in:
parent
df66df2f5c
commit
1212e6b266
@ -1,7 +1,18 @@
|
|||||||
|
var knex = require('./dbPool');
|
||||||
|
var logger = require('./logger');
|
||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
|
|
||||||
app.get('/health', function (req, res) {
|
app.get('/health', function (req, res) {
|
||||||
|
knex.select(1)
|
||||||
|
.from('features')
|
||||||
|
.then(function() {
|
||||||
res.json({health: 'GOOD'});
|
res.json({health: 'GOOD'});
|
||||||
|
})
|
||||||
|
.catch(function(err) {
|
||||||
|
logger.error('Could not select from features, error was: ', err);
|
||||||
|
res.status(500).json({health: 'BAD'});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user