I'm using the gem redis-rails and doesn't work for api mode. I do not know how to pass the redis configuration for session_store.
Ruby 2.5.0, Rails 5.1.4, Devise 4.4.0, redis-rails 5.0.2
#config/application.rb
config.api_only = true
# needed for devise
config.middleware.use Rack::MethodOverride
config.middleware.use ActionDispatch::Cookies
# needed for redis session in devise
config.middleware.use ActionDispatch::Session::RedisStore, conf_from_initializer_session_store
# config/initializers/session_store.rb
MiApp::Application.config.session_store :redis_store, {
servers: [
{
host: "localhost",
port: 6379,
db: 1,
namespace: "mi_app:session"
},
],
expire_after: 90.days,
key: ENV['REDIS_SESSION_KEY']
}
It is possible to pass the redis configuration directly in the middleware.