mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
fcd275f6c0
refs #9866 - Moved web/middleware to web/shared/middlewares - Moved util file to web/shared/utils
19 lines
591 B
JavaScript
19 lines
591 B
JavaScript
const config = require('../../../config');
|
|
const common = require('../../../lib/common');
|
|
const 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();
|
|
};
|