lib/appfuel/initializers/aws_dynamodb.rb in appfuel-0.5.7 vs lib/appfuel/initializers/aws_dynamodb.rb in appfuel-0.5.8
- old
+ new
@@ -2,16 +2,17 @@
require 'aws-sdk'
require 'appfuel/storage/aws_dynamodb'
env = config[:env]
endpoint = config[:aws][:dynamodb][:endpoint]
+ region = config[:aws][:region] || 'us-east-1'
+ aws_config = { region: region }
+
if ['local', 'development'].include?(env.to_s) && endpoint
- Aws.config.update({
- endpoint: endpoint
- })
+ aws_config[:endpoint] = endpoint
end
- key = Appfuel::AwsDynamodb::CLIENT_CONTAINER_KEY
+ Aws.config.update(aws_config)
- client = Aws::DynamoDB::Client.new
- container.register(key, client)
+ client = Aws::DynamoDB::Client.new
+ container.register(Appfuel::AwsDynamodb::CLIENT_CONTAINER_KEY, client)
end