##// END OF EJS Templates
config: Sanitize 'appenlight' and 'gzip_responses' settings.
Martin Bornhold -
r598:30c23e4b default
parent child Browse files
Show More
@@ -338,6 +338,7 b' def includeme_first(config):'
338 config.add_static_view(
338 config.add_static_view(
339 '_static/rhodecode', path='rhodecode:public', cache_max_age=3600 * 24)
339 '_static/rhodecode', path='rhodecode:public', cache_max_age=3600 * 24)
340
340
341
341 def wrap_app_in_wsgi_middlewares(pyramid_app, config):
342 def wrap_app_in_wsgi_middlewares(pyramid_app, config):
342 """
343 """
343 Apply outer WSGI middlewares around the application.
344 Apply outer WSGI middlewares around the application.
@@ -357,11 +358,10 b' def wrap_app_in_wsgi_middlewares(pyramid'
357 pyramid_app, config.registry._pylons_compat_config['routes.map'],
358 pyramid_app, config.registry._pylons_compat_config['routes.map'],
358 skip_prefixes=(STATIC_FILE_PREFIX, '/_debug_toolbar'))
359 skip_prefixes=(STATIC_FILE_PREFIX, '/_debug_toolbar'))
359
360
360 if asbool(settings.get('appenlight', 'false')):
361 pyramid_app, _ = wrap_in_appenlight_if_enabled(
361 pyramid_app, _ = wrap_in_appenlight_if_enabled(
362 pyramid_app, config.registry._pylons_compat_config)
362 pyramid_app, config.registry._pylons_compat_config)
363
363
364 if asbool(settings.get('gzip_responses', 'true')):
364 if settings['gzip_responses']:
365 pyramid_app = make_gzip_middleware(
365 pyramid_app = make_gzip_middleware(
366 pyramid_app, settings, compress_level=1)
366 pyramid_app, settings, compress_level=1)
367
367
@@ -403,17 +403,22 b' def sanitize_settings_and_apply_defaults'
403 # should allow to pass in a prefix.
403 # should allow to pass in a prefix.
404 settings.setdefault('rhodecode.api.url', '/_admin/api')
404 settings.setdefault('rhodecode.api.url', '/_admin/api')
405
405
406 # Set the default encoding.
406 # Sanitize generic settings.
407 _list_setting(settings, 'default_encoding', 'UTF-8')
407 _list_setting(settings, 'default_encoding', 'UTF-8')
408
409 _bool_setting(settings, 'is_test', 'false')
408 _bool_setting(settings, 'is_test', 'false')
409 _bool_setting(settings, 'gzip_responses', 'false')
410
410
411 # Call split out functions that sanitize settings for each topic.
411 # Call split out functions that sanitize settings for each topic.
412 _sanitize_appenlight_settings(settings)
412 _sanitize_vcs_settings(settings)
413 _sanitize_vcs_settings(settings)
413
414
414 return settings
415 return settings
415
416
416
417
418 def _sanitize_appenlight_settings(settings):
419 _bool_setting(settings, 'appenlight', 'false')
420
421
417 def _sanitize_vcs_settings(settings):
422 def _sanitize_vcs_settings(settings):
418 """
423 """
419 Applies settings defaults and does type conversion for all VCS related
424 Applies settings defaults and does type conversion for all VCS related
General Comments 0
You need to be logged in to leave comments. Login now