2013-10-16 01:39:18 -04:00
|
|
|
require_dependency "middleware/anonymous_cache"
|
2013-04-11 02:24:08 -04:00
|
|
|
|
2013-10-16 01:39:18 -04:00
|
|
|
enabled = if Rails.configuration.respond_to?(:enable_anon_caching)
|
|
|
|
Rails.configuration.enable_anon_caching
|
|
|
|
else
|
|
|
|
Rails.env.production?
|
|
|
|
end
|
2013-05-07 03:32:43 -04:00
|
|
|
|
2013-11-12 23:28:39 -05:00
|
|
|
if !ENV['DISCOURSE_DISABLE_ANON_CACHE'] && enabled
|
2014-01-08 22:08:42 -05:00
|
|
|
# in an ideal world this is position 0, but mobile detection uses ... session and request and params
|
|
|
|
Rails.configuration.middleware.insert_after ActionDispatch::ParamsParser, Middleware::AnonymousCache
|
2013-04-11 02:24:08 -04:00
|
|
|
end
|
2013-10-16 01:39:18 -04:00
|
|
|
|