mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
0ae0a0b490
refs #6982 - a replace for all config usages - always use config.get or config.set - this a pure replacement, no logic has changed [ci skip]
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
var config = require('../../config'),
|
|
utils = require('../../utils'),
|
|
errors = require('../../errors'),
|
|
i18n = require('../../i18n'),
|
|
middleware = require('./lib/middleware'),
|
|
router = require('./lib/router');
|
|
|
|
module.exports = {
|
|
activate: function activate() {
|
|
if (utils.url.getSubdir()) {
|
|
var paths = utils.url.getSubdir().split('/');
|
|
|
|
if (paths.pop() === config.get('routeKeywords').private) {
|
|
errors.logErrorAndExit(
|
|
new Error(i18n.t('errors.config.urlCannotContainPrivateSubdir.error')),
|
|
i18n.t('errors.config.urlCannotContainPrivateSubdir.description'),
|
|
i18n.t('errors.config.urlCannotContainPrivateSubdir.help')
|
|
);
|
|
}
|
|
}
|
|
},
|
|
|
|
setupMiddleware: function setupMiddleware(blogApp) {
|
|
blogApp.use(middleware.checkIsPrivate);
|
|
blogApp.use(middleware.filterPrivateRoutes);
|
|
},
|
|
|
|
setupRoutes: function setupRoutes(blogRouter) {
|
|
blogRouter.use('/' + config.get('routeKeywords').private + '/', router);
|
|
}
|
|
};
|