aws-sessionstore-dynamodb 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +5 -5
  2. data/.github/PULL_REQUEST_TEMPLATE.md +6 -0
  3. data/.gitignore +1 -0
  4. data/.gitmodules +3 -0
  5. data/.travis.yml +16 -5
  6. data/.yardopts +3 -2
  7. data/CHANGELOG.md +24 -0
  8. data/CODE_OF_CONDUCT.md +4 -0
  9. data/CONTRIBUTING.md +61 -0
  10. data/Gemfile +7 -19
  11. data/{LICENSE.txt → LICENSE} +0 -0
  12. data/README.md +17 -63
  13. data/Rakefile +37 -14
  14. data/VERSION +1 -0
  15. data/aws-sessionstore-dynamodb.gemspec +7 -5
  16. data/doc-src/templates/default/layout/html/footer.erb +10 -0
  17. data/doc-src/templates/default/layout/html/layout.erb +31 -0
  18. data/lib/aws-sessionstore-dynamodb.rb +0 -15
  19. data/lib/aws/session_store/dynamo_db/configuration.rb +2 -29
  20. data/lib/aws/session_store/dynamo_db/errors/base_handler.rb +0 -14
  21. data/lib/aws/session_store/dynamo_db/errors/default_handler.rb +0 -14
  22. data/lib/aws/session_store/dynamo_db/garbage_collection.rb +2 -15
  23. data/lib/aws/session_store/dynamo_db/invalid_id_error.rb +0 -14
  24. data/lib/aws/session_store/dynamo_db/lock_wait_timeout_error.rb +0 -14
  25. data/lib/aws/session_store/dynamo_db/locking/base.rb +14 -17
  26. data/lib/aws/session_store/dynamo_db/locking/null.rb +0 -14
  27. data/lib/aws/session_store/dynamo_db/locking/pessimistic.rb +0 -16
  28. data/lib/aws/session_store/dynamo_db/missing_secret_key_error.rb +0 -14
  29. data/lib/aws/session_store/dynamo_db/rack_middleware.rb +11 -24
  30. data/lib/aws/session_store/dynamo_db/table.rb +1 -14
  31. data/lib/aws/session_store/dynamo_db/version.rb +1 -15
  32. data/spec/aws/session_store/dynamo_db/app_config.yml +6 -6
  33. data/spec/aws/session_store/dynamo_db/configuration_spec.rb +28 -51
  34. data/spec/aws/session_store/dynamo_db/error/default_error_handler_spec.rb +23 -21
  35. data/spec/aws/session_store/dynamo_db/garbage_collection_spec.rb +68 -69
  36. data/spec/aws/session_store/dynamo_db/locking/threaded_sessions_spec.rb +17 -16
  37. data/spec/aws/session_store/dynamo_db/rack_middleware_database_spec.rb +47 -46
  38. data/spec/aws/session_store/dynamo_db/rack_middleware_spec.rb +59 -61
  39. data/spec/aws/session_store/dynamo_db/table_spec.rb +9 -7
  40. data/spec/spec_helper.rb +14 -11
  41. metadata +27 -29
  42. data/lib/aws/session_store/dynamo_db/railtie.rb +0 -28
  43. data/lib/aws/session_store/dynamo_db/tasks/session_table.rake +0 -21
  44. data/lib/rails/generators/sessionstore/dynamodb/dynamodb_generator.rb +0 -55
  45. data/lib/rails/generators/sessionstore/dynamodb/templates/sessionstore/USAGE +0 -13
  46. data/lib/rails/generators/sessionstore/dynamodb/templates/sessionstore/dynamodb.yml +0 -71
  47. data/lib/rails/generators/sessionstore/dynamodb/templates/sessionstore_migration.rb +0 -10
  48. data/spec/aws/session_store/dynamo_db/config/dynamo_db_session.yml +0 -24
  49. data/spec/aws/session_store/dynamo_db/rails_app_config.yml +0 -24
  50. data/tasks/test.rake +0 -29
@@ -1,21 +0,0 @@
1
- # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You
4
- # may not use this file except in compliance with the License. A copy of
5
- # the License is located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is
10
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- # ANY KIND, either express or implied. See the License for the specific
12
- # language governing permissions and limitations under the License.
13
-
14
- namespace "db" do
15
- namespace "sessions" do
16
- desc 'Clean up old sessions in Amazon DynamoDB session store'
17
- task :cleanup => :environment do |t|
18
- Aws::SessionStore::DynamoDB::GarbageCollection.collect_garbage
19
- end
20
- end
21
- end
@@ -1,55 +0,0 @@
1
- # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You
4
- # may not use this file except in compliance with the License. A copy of
5
- # the License is located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is
10
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- # ANY KIND, either express or implied. See the License for the specific
12
- # language governing permissions and limitations under the License.
13
-
14
- require 'rails/generators/named_base'
15
-
16
- # This class generates
17
- # a migration file for deleting and creating
18
- # a DynamoDB sessions table.
19
- module Sessionstore
20
- module Generators
21
- class DynamodbGenerator < Rails::Generators::NamedBase
22
- include Rails::Generators::Migration
23
-
24
- source_root File.expand_path('templates', File.dirname(__FILE__))
25
-
26
- # Desired name of migration class
27
- argument :name, :type => :string, :default => "sessionstore_migration"
28
-
29
- # @return [Rails Migration File] migration file for creation and deletion of
30
- # session table.
31
- def generate_migration_file
32
- migration_template "sessionstore_migration.rb",
33
- "#{Rails.root}/db/migrate/#{file_name}"
34
- end
35
-
36
-
37
- def copy_sample_config_file
38
- file = File.join("sessionstore", "dynamodb.yml")
39
- template file, File.join(Rails.root, "config", file)
40
- end
41
-
42
- private
43
-
44
- # @return [String] filename
45
- def file_name
46
- name.underscore
47
- end
48
-
49
- # @return [String] migration version using time stamp YYYYMMDDHHSS
50
- def self.next_migration_number(dir = nil)
51
- Time.now.utc.strftime("%Y%m%d%H%M%S")
52
- end
53
- end
54
- end
55
- end
@@ -1,13 +0,0 @@
1
- Description:
2
- Generates a migration file for deleting and a creating a DynamoDB
3
- sessions table, and a configuration file for the session store.
4
-
5
- Example:
6
- rails generate sessionstore:dynamodb <MigrationName>
7
-
8
- This will create:
9
- db/migrate/VERSION_migration_name.rb
10
- config/sessionstore/dynamodb.yml
11
-
12
- The migration will be run when the command rake db:migrate is run
13
- in the command line.
@@ -1,71 +0,0 @@
1
- # Uncomment and manipulate the key value pairs below
2
- # in order to configure the DynamoDB Session Store Application.
3
-
4
- # [String] The secret key for HMAC encryption.
5
- # Must define secret_key here or ENV or at runtime!
6
- # By default, a random key was generated for you!
7
- #
8
- secret_key: <%= require 'securerandom'; SecureRandom.hex(64) %>
9
-
10
- # [String] Session table name.
11
- #
12
- # table_name: Sessions
13
-
14
- # [String] Session table hash key name.
15
- #
16
- # table_key: session_id
17
-
18
- # [Boolean] Define as true or false depending on if you want a strongly
19
- # consistent read.
20
- # See AWS DynamoDB documentation for table consistent_read for more
21
- # information on this setting.
22
- #
23
- # consistent_read: true
24
-
25
- # [Integer] Maximum number of reads consumed per second before
26
- # DynamoDB returns a ThrottlingException. See AWS DynamoDB documentation
27
- # or table read_capacity for more information on this setting.
28
- #
29
- # read_capacity: 10
30
-
31
- # [Integer] Maximum number of writes consumed per second before
32
- # DynamoDB returns a ThrottlingException. See AWS DynamoDB documentation
33
- # or table write_capacity for more information on this setting.
34
- #
35
- # write_capacity: 5
36
-
37
- # [Boolean] Define as true or false depending on whether you want all errors to be
38
- # raised up the stack.
39
- #
40
- # raise_errors: false
41
-
42
- # [Integer] Maximum number of seconds earlier
43
- # from the current time that a session was created.
44
- # By default this is 7 days.
45
- #
46
- # max_age: 604800
47
-
48
- # [Integer] Maximum number of seconds
49
- # before the current time that the session was last accessed.
50
- # By default this is 5 hours.
51
- #
52
- # max_stale: 18000
53
-
54
- # [Boolean] Define as true or false for whether you want to enable locking
55
- # for all accesses to session data.
56
- #
57
- # enable_locking: false
58
-
59
- # [Integer] Time in milleseconds after which lock will expire.
60
- #
61
- # lock_expiry_time: 500
62
-
63
- # [Integer] Time in milleseconds to wait before retrying to obtain
64
- # lock once an attempt to obtain lock has been made and has failed.
65
- #
66
- # lock_retry_delay: 500
67
-
68
- # [Integer] Maximum time in seconds to wait to acquire lock
69
- # before giving up.
70
- #
71
- # lock_max_wait_time: 1
@@ -1,10 +0,0 @@
1
- class <%= name.camelize %> < ActiveRecord::Migration
2
- def up
3
- Aws::SessionStore::DynamoDB::Table.create_table
4
- end
5
-
6
- def down
7
- Aws::SessionStore::DynamoDB::Table.delete_table
8
- end
9
- end
10
-
@@ -1,24 +0,0 @@
1
- # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You
4
- # may not use this file except in compliance with the License. A copy of
5
- # the License is located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is
10
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- # ANY KIND, either express or implied. See the License for the specific
12
- # language governing permissions and limitations under the License.
13
-
14
- development:
15
- key1: development value 1
16
- test:
17
- table_name: NewTable
18
- table_key: Somekey
19
- consistent_read: true
20
- AWS_ACCESS_KEY_ID: FakeKey
21
- AWS_SECRET_ACCESS_KEY: Secret
22
- AWS_REGION: New York
23
- production:
24
- key1: production value 1
@@ -1,24 +0,0 @@
1
- # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You
4
- # may not use this file except in compliance with the License. A copy of
5
- # the License is located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is
10
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- # ANY KIND, either express or implied. See the License for the specific
12
- # language governing permissions and limitations under the License.
13
-
14
- development:
15
- key1: development value 1
16
- test:
17
- table_name: NewTable
18
- table_key: Somekey
19
- consistent_read: true
20
- AWS_ACCESS_KEY_ID: FakeKey
21
- AWS_SECRET_ACCESS_KEY: Secret
22
- AWS_REGION: New York
23
- production:
24
- key1: production value 1
@@ -1,29 +0,0 @@
1
- # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You
4
- # may not use this file except in compliance with the License. A copy of
5
- # the License is located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is
10
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- # ANY KIND, either express or implied. See the License for the specific
12
- # language governing permissions and limitations under the License.
13
-
14
- namespace :test do
15
- desc 'Run unit tests'
16
- task :unit do
17
- sh "bundle exec rspec -t ~integration"
18
- end
19
-
20
- desc 'Run integration tests'
21
- task :integration do
22
- sh "bundle exec rspec -t integration"
23
- end
24
-
25
- desc 'Run all tests'
26
- task :all do
27
- sh "bundle exec rspec"
28
- end
29
- end