Class: ActionDispatch::Session::DynamoDbStore

Inherits:
AbstractStore
  • Object
show all
Defined in:
lib/action_dispatch/session/dynamo_db_store.rb

Overview

Uses the DynamoDB Session Store implementation to create a class that extends ActionDispatch::Session. Rails will create a :dynamo_db_store configuration for :session_store from this class name.

This class will use Rails.application.secret_key_base as the secret key unless otherwise provided.

Configuration can also be provided in YAML files from Rails config, either in config/aws_dynamo_db_session_store.yml or config/aws_dynamo_db_session_store/{Rails.env}.yml. Configuration files that are environment-specific will take precedence.

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ DynamoDbStore

Returns a new instance of DynamoDbStore.



22
23
24
25
26
27
28
# File 'lib/action_dispatch/session/dynamo_db_store.rb', line 22

def initialize(app, options = {})
  options[:config_file] ||= config_file
  options[:secret_key] ||= Rails.application.secret_key_base
  @middleware = Aws::SessionStore::DynamoDB::RackMiddleware.new(app, options)
  config.dynamo_db_client.config.user_agent_frameworks << 'aws-actiondispatch-dynamodb'
  super
end

Instance Method Details

#configAws::SessionStore::DynamoDB::Configuration

Returns:

  • (Aws::SessionStore::DynamoDB::Configuration)


31
32
33
# File 'lib/action_dispatch/session/dynamo_db_store.rb', line 31

def config
  @middleware.config
end