Skip to content

Commit c14a14d

Browse files
authored
Merge pull request #5 from localstack-samples/migrate-to-aws-endpoint-url
Migrate to AWS_ENDPOINT_URL
2 parents 260aec8 + e4f841f commit c14a14d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

shipment-picture-lambda-validator/src/main/java/dev/ancaghenade/shipmentpicturelambdavalidator/S3ClientHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
public class S3ClientHelper {
99

10-
private static final String LOCALSTACK_HOSTNAME = System.getenv("LOCALSTACK_HOSTNAME");
10+
private static final String AWS_ENDPOINT_URL = System.getenv("AWS_ENDPOINT_URL");
1111

1212
public static S3Client getS3Client() throws IOException {
1313

1414
var clientBuilder = S3Client.builder();
15-
if (Objects.nonNull(LOCALSTACK_HOSTNAME)) {
15+
if (Objects.nonNull(AWS_ENDPOINT_URL)) {
1616
return clientBuilder
1717
.region(Location.REGION.getRegion())
18-
.endpointOverride(URI.create(String.format("http://%s:4566", LOCALSTACK_HOSTNAME)))
18+
.endpointOverride(URI.create(AWS_ENDPOINT_URL))
1919
.forcePathStyle(true)
2020
.build();
2121
} else {

shipment-picture-lambda-validator/src/main/java/dev/ancaghenade/shipmentpicturelambdavalidator/SNSClientHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66

77
public class SNSClientHelper {
88

9-
private static final String LOCALSTACK_HOSTNAME = System.getenv("LOCALSTACK_HOSTNAME");
9+
private static final String AWS_ENDPOINT_URL = System.getenv("AWS_ENDPOINT_URL");
1010
private static String snsTopicArn;
1111

1212
public static SnsClient getSnsClient() {
1313

1414
var clientBuilder = SnsClient.builder();
1515

16-
if (Objects.nonNull(LOCALSTACK_HOSTNAME)) {
16+
if (Objects.nonNull(AWS_ENDPOINT_URL)) {
1717
snsTopicArn = String.format("arn:aws:sns:%s:000000000000:update_shipment_picture_topic",
1818
Location.REGION.getRegion());
1919

2020
return clientBuilder
2121
.region(Location.REGION.getRegion())
22-
.endpointOverride(URI.create(String.format("http://%s:4566", LOCALSTACK_HOSTNAME)))
22+
.endpointOverride(URI.create(AWS_ENDPOINT_URL))
2323
.build();
2424
} else {
2525
snsTopicArn = String.format("arn:aws:sns:%s:%s:update_shipment_picture_topic",

0 commit comments

Comments
 (0)