]> git.openstreetmap.org Git - rails.git/commitdiff
Use memcache to store temporary OpenID data
authorTom Hughes <tom@compton.nu>
Wed, 9 May 2012 09:14:58 +0000 (10:14 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 9 May 2012 09:14:58 +0000 (10:14 +0100)
OpenID nonces and associations need to be visible across all the
servers in the production cluster, so store them in memcache where
everything can see them properly.

config/initializers/openid.rb

index 966164b3e9e640b2a8165d05c1ffa3d5a67cb8ed..a171d1e7b27f3093d5c3f916658715cb3069d62d 100644 (file)
@@ -1 +1,7 @@
-OpenIdAuthentication.store = :file
+if defined?(MEMCACHE_SERVERS)
+  require "openid/store/memcache"
+
+  OpenIdAuthentication.store = OpenID::Store::Memcache.new(MemCache.new(:namespace => "rails", :string_return_types => true))
+else
+  OpenIdAuthentication.store = :file
+end