Skip to content

Prepare version 1 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Unreleased Changes
------------------

* Feature - [Major Version] Bump major version to 1.0.0.

* Issue - Drop support for any non-aws prefixed configuration keys.

* Issue - Drop support for the `:dynamodb_store` configuration name.

0.2.0 (2024-11-17)
------------------

Expand Down
32 changes: 4 additions & 28 deletions lib/action_dispatch/session/dynamo_db_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ module Session
# 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`.
# 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.
#
# @see https://docs.aws.amazon.com/sdk-for-ruby/aws-sessionstore-dynamodb/api/Aws/SessionStore/DynamoDB/Configuration.html
class DynamoDbStore < ActionDispatch::Session::AbstractStore
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)
Expand Down Expand Up @@ -51,34 +49,12 @@ def delete_session(req, sid, options)
@middleware.delete_session(req, sid, options)
end

# rubocop:disable Metrics
def config_file
file = ENV.fetch('AWS_DYNAMO_DB_SESSION_CONFIG_FILE', nil)
file ||= Rails.root.join("config/dynamo_db_session_store/#{Rails.env}.yml")
file = Rails.root.join('config/dynamo_db_session_store.yml') unless File.exist?(file)
if File.exist?(file)
Rails.logger.warn('The dynamo_db_session_store configuration file has been renamed.' \
'Please use aws_dynamo_db_session_store/<Rails.env>.yml or ' \
'aws_dynamo_db_session_store.yml. This will be removed in ' \
'aws-actiondispatch-dynamodb ~> 1')
else
file = Rails.root.join("config/aws_dynamo_db_session_store/#{Rails.env}.yml")
file = Rails.root.join('config/aws_dynamo_db_session_store.yml') unless File.exist?(file)
end

file ||= Rails.root.join("config/aws_dynamo_db_session_store/#{Rails.env}.yml")
file = Rails.root.join('config/aws_dynamo_db_session_store.yml') unless File.exist?(file)
file if File.exist?(file)
end
end
# rubocop:enable Metrics

# @api private
class DynamodbStore < DynamoDbStore
def initialize(app, options = {})
Rails.logger.warn('** Session Store :dynamodb_store configuration key has been renamed to :dynamo_db_store, ' \
'please use the new key instead. The :dynamodb_store key name will be removed in ' \
'aws-actiondispatch-dynamodb ~> 1 **')
super
end
end
end
end