reload config on each poll

This commit is contained in:
Josh Harvey 2015-04-30 18:13:13 -04:00
parent d5c69079d5
commit 7f14fb3adc
3 changed files with 19 additions and 5 deletions

View file

@ -46,6 +46,17 @@ module.exports = function(options) {
app.use(express.bodyParser());
var reloadConfigMiddleware = function(req, res, next) {
lamassuConfig.load(function(err, config) {
if (err) {
logger.error('Error while reloading config');
return next(err)
}
plugins.configure(config);
next();
});
};
var authMiddleware;
if (options.https) {
@ -91,6 +102,7 @@ module.exports = function(options) {
lamassuConfig: lamassuConfig,
plugins: plugins,
authMiddleware: authMiddleware,
reloadConfigMiddleware: reloadConfigMiddleware,
mock: options.mock
});