Skip to content

Commit 1a2a0ca

Browse files
committed
Also update the endpoint stuff in randomizer-dbtools
1 parent 476d4f7 commit 1a2a0ca

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

cmd/randomizer-dbtools/dynamodb.go

+6-14
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,14 @@ func init() {
4242
}
4343

4444
func getDynamoDB() *dynamodb.Client {
45-
var options []func(*config.LoadOptions) error
46-
if dynamoDBEndpoint != "" {
47-
options = append(options,
48-
config.WithEndpointResolverWithOptions(aws.EndpointResolverWithOptionsFunc(
49-
func(_, _ string, _ ...any) (aws.Endpoint, error) {
50-
return aws.Endpoint{URL: dynamoDBEndpoint}, nil
51-
},
52-
)),
53-
)
54-
}
55-
56-
cfg, err := config.LoadDefaultConfig(context.Background(), options...)
45+
cfg, err := config.LoadDefaultConfig(context.Background())
5746
if err != nil {
5847
fmt.Fprintf(os.Stderr, "could not load AWS config: %v\n", err)
5948
os.Exit(2)
6049
}
61-
62-
return dynamodb.NewFromConfig(cfg)
50+
return dynamodb.NewFromConfig(cfg, func(opts *dynamodb.Options) {
51+
if dynamoDBEndpoint != "" {
52+
opts.BaseEndpoint = aws.String(dynamoDBEndpoint)
53+
}
54+
})
6355
}

0 commit comments

Comments
 (0)