vendor/dynomite/lib/dynomite/db_config.rb in jets-1.0.16 vs vendor/dynomite/lib/dynomite/db_config.rb in jets-1.0.17
- old
+ new
@@ -24,11 +24,17 @@
config = db_config
endpoint = ENV['DYNAMODB_ENDPOINT'] || config['endpoint']
check_dynamodb_local!(endpoint)
- Aws.config.update(endpoint: endpoint) if endpoint
- @@db ||= Aws::DynamoDB::Client.new
+ # Normally, do not set the endpoint to use the current configured region.
+ # Probably want to stay in the same region anyway for db connections.
+ #
+ # List of regional endpoints: https://docs.aws.amazon.com/general/latest/gr/rande.html#ddb_region
+ # Example:
+ # endpoint: https://dynamodb.us-east-1.amazonaws.com
+ options = endpoint ? { endpoint: endpoint } : {}
+ @@db ||= Aws::DynamoDB::Client.new(options)
end
# When endoint has been configured to point at dynamodb local: localhost:8000
# check if port 8000 is listening and timeout quickly. Or else it takes a
# for DynamoDB local to time out, about 10 seconds...