0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00
ghost/core/server/web/middleware/maintenance.js
2018-09-10 14:07:57 +02:00

19 lines
578 B
JavaScript

const config = require('../../config'),
common = require('../../lib/common'),
urlService = require('../../services/url');
module.exports = function maintenance(req, res, next) {
if (config.get('maintenance').enabled) {
return next(new common.errors.MaintenanceError({
message: common.i18n.t('errors.general.maintenance')
}));
}
if (!urlService.hasFinished()) {
return next(new common.errors.MaintenanceError({
message: common.i18n.t('errors.general.maintenanceUrlService')
}));
}
next();
};