Commit e8ee4f05 by lanrion

added redis configure

parent 5f289652
# encoding: utf-8 # encoding: utf-8
require "redis"
module WeixinAuthorize module WeixinAuthorize
class Client class Client
......
module WeixinAuthorize
class << self
attr_accessor :config
def configure
yield self.config ||= Config.new
end
end
class Config
attr_accessor :redis
end
end
...@@ -16,7 +16,17 @@ ...@@ -16,7 +16,17 @@
require "rspec" require "rspec"
require "weixin_authorize" require "weixin_authorize"
require "multi_json" require "multi_json"
require "redis"
require "redis-namespace"
require "pry-rails"
redis = Redis.new(:host => "127.0.0.1",:port => "6379")
redis_with_ns = Redis::Namespace.new("your_app_name:weixin_authorize", :redis => redis)
WeixinAuthorize.configure do |config|
config.redis = redis_with_ns
end
$client = WeixinAuthorize::Client.new(ENV["APPID"], ENV["APPSECRET"]) $client = WeixinAuthorize::Client.new(ENV["APPID"], ENV["APPSECRET"])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment