Ghost/core/server/middleware/maintenance.js
Hannah Wolfe d08926c347 Allow maintenance mode to be set in config.js (#7124)
refs #6976, #7019, #7125

- Ensure maintenance mode flag is set back to what is in config.js rather than defaulted to false on boot
- Remove stack trace from 503 errors
- Add error message to 503 error
- Ensure error page is rendered for Ghost-Admin on reload with 503
2016-07-25 21:28:35 +02:00

14 lines
314 B
JavaScript

var config = require('../config'),
i18n = require('../i18n'),
errors = require('../errors');
module.exports = function (req, res, next) {
if (config.maintenance.enabled) {
return next(new errors.Maintenance(
i18n.t('errors.general.maintenance')
));
}
next();
};