From 8faae673b4f58c980f0e71fc606c176c059dcacf Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 6 May 2021 13:16:34 +0200 Subject: [PATCH] Merge pull request #4000 from overleaf/jpa-skip-pug-compile [Server] optionally skip pre-compiling pug templates in production GitOrigin-RevId: c50e6007dae3b0ab83a7edbce07a695a17e71404 --- services/web/app/src/infrastructure/Server.js | 2 +- services/web/config/settings.defaults.coffee | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/web/app/src/infrastructure/Server.js b/services/web/app/src/infrastructure/Server.js index f43da1d757..eec9a316eb 100644 --- a/services/web/app/src/infrastructure/Server.js +++ b/services/web/app/src/infrastructure/Server.js @@ -242,7 +242,7 @@ if (Settings.enabledServices.includes('api')) { if (Settings.enabledServices.includes('web')) { logger.info('providing web router') - if (app.get('env') === 'production') { + if (Settings.precompilePugTemplatesAtBootTime) { logger.info('precompiling views for web in production environment') Views.precompileViews(app) } diff --git a/services/web/config/settings.defaults.coffee b/services/web/config/settings.defaults.coffee index 8556dc3bc6..82ab2a2932 100644 --- a/services/web/config/settings.defaults.coffee +++ b/services/web/config/settings.defaults.coffee @@ -473,6 +473,7 @@ module.exports = settings = # Production Settings # ------------------- debugPugTemplates: process.env['DEBUG_PUG_TEMPLATES'] == 'true' + precompilePugTemplatesAtBootTime: if process.env['PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME'] then process.env['PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME'] == 'true' else process.env.NODE_ENV == 'production' # Should javascript assets be served minified or not. Note that you will # need to run `grunt compile:minify` within the web-sharelatex directory