Skip to content

Commit

Permalink
Make sure rack_cache[:verbose] can be set (#96)
Browse files Browse the repository at this point in the history
This exploded for me.
Copied a commit from lograge which solved the same issue:
roidrage/lograge#103
  • Loading branch information
jdurand authored Apr 12, 2020
1 parent 9e7c04e commit 08b6db9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/logstasher/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Railtie < Rails::Railtie
LogStasher.process_config(app.config.logstasher, LOGSTASHER[env].symbolize_keys) if LOGSTASHER.key? env
end

app.config.action_dispatch.rack_cache[:verbose] = false if app.config.action_dispatch.rack_cache
app.config.action_dispatch.rack_cache[:verbose] = false if rack_cache_hashlike?(app)

LogStasher.setup_before(app.config.logstasher) if app.config.logstasher.enabled
end

Expand All @@ -39,6 +40,10 @@ class Railtie < Rails::Railtie
LogStasher.setup(config.logstasher) if config.logstasher.enabled
end
end

def rack_cache_hashlike?(app)
app.config.action_dispatch.rack_cache && app.config.action_dispatch.rack_cache.respond_to?(:[]=)
end
end

def default_source
Expand Down

0 comments on commit 08b6db9

Please sign in to comment.