localstack / localstack-java-utils

☕ Java utilities and JUnit integration for LocalStack
Apache License 2.0
75 stars 43 forks source link

Configure port binding behaviour #33

Closed Madh93 closed 3 years ago

Madh93 commented 3 years ago

Hi,

This is a possible implementation of #31 to bind the Edge and ElasticSearch ports to a custom port using the @LocalstackDockerProperties annotation:

Changes

Examples

Example of custom ports:

@LocalstackDockerProperties(portEdge = "45660", portElasticSearch = "45710", services = {"dynamodb"})
// public class ...

Example of random ports (alternative to the deprecated randomizePorts property):

@LocalstackDockerProperties(portEdge = ":4566", portElasticSearch = ":4571", services = {"dynamodb"})
// public class ...

Example of default ports (4566 and 4571):

@LocalstackDockerProperties(services = {"dynamodb"})
// public class ...
whummer commented 3 years ago

Looks great, thanks for this enhancement @Madh93 !! We'll release a new version to Maven Central shortly.. Thanks