"Fossies" - the Fresh Open Source Software Archive

Member "discourse-2.8.3/config/initializers/099-anon-cache.rb" (14 Apr 2022, 476 Bytes) of package /linux/www/discourse-2.8.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 # frozen_string_literal: true
    2 
    3 require "middleware/anonymous_cache"
    4 
    5 enabled =
    6   if Rails.configuration.respond_to?(:enable_anon_caching)
    7     Rails.configuration.enable_anon_caching
    8   else
    9     Rails.env.production?
   10   end
   11 
   12 if !ENV['DISCOURSE_DISABLE_ANON_CACHE'] && enabled
   13   # in an ideal world this is position 0, but mobile detection uses ... session and request and params
   14   Rails.configuration.middleware.insert_after ActionDispatch::Flash, Middleware::AnonymousCache
   15 end