mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-28 09:55:51 +00:00
Warn if Redis gem is < 3.0.0
Prefer printing a log message if this criteria is not met, instead of failing silently.
This commit is contained in:
parent
dc308add10
commit
69ab514477
1 changed files with 7 additions and 0 deletions
|
|
@ -4,6 +4,13 @@ module Rack
|
|||
class Attack
|
||||
module StoreProxy
|
||||
class RedisStoreProxy < SimpleDelegator
|
||||
def initialize(*args)
|
||||
major_version = Redis::VERSION.split('.').first.to_i
|
||||
warn 'RackAttack requires Redis gem >= 3.0.0.' if major_version < 3
|
||||
|
||||
super(*args)
|
||||
end
|
||||
|
||||
def self.handle?(store)
|
||||
defined?(::Redis::Store) && store.is_a?(::Redis::Store)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue