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/dynamo_db_session_store.yml` or `config/dynamo_db_session_store/Rails.env.yml`. Configuration files that are environment-specific will take precedence.

Direct Known Subclasses

DynamodbStore

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of DynamoDbStore.



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

def initialize(app, options = {})
  Rails.logger.warn('** Dynamo DB Session Storage no longer lives in aws-sdk-rails. ' \
                    'To avoid disruption, please add aws-actiondispatch-dynamodb ~> 0 to your Gemfile to ' \
                    'enable this feature when upgrading to aws-sdk-rails ~> 5. **')
  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)


33
34
35
# File 'lib/action_dispatch/session/dynamo_db_store.rb', line 33

def config
  @middleware.config
end