Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Drop need for credentials if endpoint is localhost #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,17 @@ private[dynamodb] trait DynamoConnector {
val credentials = getCredentials(chosenRegion, roleArn, providerClassName)

properties.get("aws.dynamodb.endpoint").map(endpoint => {
AmazonDynamoDBClientBuilder.standard()
.withCredentials(credentials)
.withEndpointConfiguration(new EndpointConfiguration(endpoint, chosenRegion))
.build()
// No need for credentials if using local DynamoDB instance.
if (endpoint.startsWith("http://localhost:")) {
AmazonDynamoDBClientBuilder.standard()
.withEndpointConfiguration(new EndpointConfiguration(endpoint, chosenRegion))
.build()
} else {
AmazonDynamoDBClientBuilder.standard()
.withCredentials(credentials)
.withEndpointConfiguration(new EndpointConfiguration(endpoint, chosenRegion))
.build()
}
}).getOrElse(
AmazonDynamoDBClientBuilder.standard()
.withCredentials(credentials)
Expand Down