mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
support separate processes for web and api
via an environment variable WEB_TYPE
This commit is contained in:
parent
5ac2ed8fc6
commit
4b188ce120
1 changed files with 19 additions and 7 deletions
|
@ -161,8 +161,21 @@ app.get "/heapdump", (req, res)->
|
||||||
logger.info ("creating HTTP server").yellow
|
logger.info ("creating HTTP server").yellow
|
||||||
server = require('http').createServer(app)
|
server = require('http').createServer(app)
|
||||||
|
|
||||||
|
# can set WEB_TYPE=api-only or WEB_TYPE=web-only for separate web and
|
||||||
|
# api processes
|
||||||
|
switch process.env.WEB_TYPE
|
||||||
|
when "api-only"
|
||||||
|
logger.info("providing api router");
|
||||||
|
app.use(apiRouter)
|
||||||
|
app.use(ErrorController.handleApiError)
|
||||||
|
when "web-only"
|
||||||
|
logger.info("providing web router");
|
||||||
|
app.use(webRouter)
|
||||||
|
app.use(ErrorController.handleError)
|
||||||
|
else
|
||||||
|
logger.info("providing web and api router");
|
||||||
# process api routes first, if nothing matched fall though and use
|
# process api routes first, if nothing matched fall though and use
|
||||||
# web middlewear + routes
|
# web middleware + routes
|
||||||
app.use(apiRouter)
|
app.use(apiRouter)
|
||||||
app.use(ErrorController.handleApiError)
|
app.use(ErrorController.handleApiError)
|
||||||
app.use(webRouter)
|
app.use(webRouter)
|
||||||
|
@ -170,7 +183,6 @@ app.use(ErrorController.handleError)
|
||||||
|
|
||||||
router = new Router(webRouter, apiRouter)
|
router = new Router(webRouter, apiRouter)
|
||||||
|
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
app: app
|
app: app
|
||||||
server: server
|
server: server
|
||||||
|
|
Loading…
Reference in a new issue