Merge pull request #3319 from overleaf/em-enabled-services

Use ENABLED_SERVICES variable to choose which routes to set up

GitOrigin-RevId: 6b1f8d593de23d72802c178d2e3cc89757257675
This commit is contained in:
Eric Mc Sween 2020-10-27 09:14:11 -04:00 committed by Copybot
parent bffb02a216
commit d708f6f0db
2 changed files with 4 additions and 9 deletions

View file

@ -225,21 +225,14 @@ logger.info('creating HTTP server'.yellow)
const server = require('http').createServer(app)
// provide settings for separate web and api processes
// if enableApiRouter and enableWebRouter are not defined they default
// to true.
const notDefined = x => x == null
const enableApiRouter =
Settings.web != null ? Settings.web.enableApiRouter : undefined
if (enableApiRouter || notDefined(enableApiRouter)) {
if (Settings.enabledServices.includes('api')) {
logger.info('providing api router')
app.use(privateApiRouter)
app.use(Validation.errorMiddleware)
app.use(ErrorController.handleApiError)
}
const enableWebRouter =
Settings.web != null ? Settings.web.enableWebRouter : undefined
if (enableWebRouter || notDefined(enableWebRouter)) {
if (Settings.enabledServices.includes('web')) {
logger.info('providing web router')
if (app.get('env') === 'production') {

View file

@ -634,6 +634,8 @@ module.exports = settings =
# {imageName: 'texlive-full:2014.2', imageDesc: 'Legacy SL TeXLive 2014.2'}
# ]
enabledServices: (process.env['ENABLED_SERVICES'] || 'web,api').split(',').map((s) => s.trim())
# module options
# ----------
modules: