Sharing services w/ middleware
markalanevans opened this issue · 0 comments
markalanevans commented
Goliath + RackAttack + Redis
I'd like to be able to pass the redis connection i create in the config dir to the rack middleware i created:
config['redis'] = EM::Synchrony::ConnectionPool.new size: 2 do
Redis.new(:host => redis_host, :port => redis_port, :password => redis_password)
end
And use redis the same redis connection for my middleware.
Rack::Attack.cache.store = Rack::Attack::StoreProxy::RedisStoreProxy.new(redis)
Problem being that in middleware redis is not defined.
How might i share this connection?