lib/loco/config.rb in loco-rails-1.3.3 vs lib/loco/config.rb in loco-rails-1.4.0

- old
+ new

@@ -1,24 +1,25 @@ module Loco class Config cattr_accessor(:silence_logger){ false } cattr_accessor(:notifications_size){ 100 } cattr_accessor(:app_name){ 'loco' } - cattr_accessor(:ws_connection_storage){ 'redis' } + cattr_accessor(:redis_instance){ nil } def self.configure opts = {} self.silence_logger = opts[:silence_logger] if not opts[:silence_logger].nil? self.notifications_size = opts[:notifications_size] if opts[:notifications_size] self.app_name = opts[:app_name] if opts[:app_name] - begin - self.ws_connection_storage = if defined?(Redis) && Redis.current.get('version') - 'redis' - else - 'in_process' - end - rescue Redis::CannotConnectError - self.ws_connection_storage = 'in_process' + if opts[:redis_instance] + self.redis_instance = opts[:redis_instance] + return end - true + return if not defined?(Redis) + Redis.current.get 'random_redis_key' + self.redis_instance = Redis.current + rescue Redis::CannotConnectError + self.redis_instance = nil + ensure + return true end end -end \ No newline at end of file +end