Просмотр исходного кода

Merge pull request #4000 from overleaf/jpa-skip-pug-compile

[Server] optionally skip pre-compiling pug templates in production

GitOrigin-RevId: c50e6007dae3b0ab83a7edbce07a695a17e71404
Jakob Ackermann 5 лет назад
Родитель
Сommit
8faae673b4

+ 1 - 1
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)
   }

+ 1 - 0
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