Skip to content

Commit

Permalink
feat: #11 Add 2 more properties, splitting grpc host and port
Browse files Browse the repository at this point in the history
Signed-off-by: Laurent Broudoux <[email protected]>
  • Loading branch information
lbroudoux committed Oct 24, 2023
1 parent 16a23d7 commit ac1e1c3
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public class DevServicesMicrocksProcessor {
private static final String CONFIG_PREFIX = "quarkus.microcks.";
private static final String HTTP_SUFFIX = ".http";
private static final String GRPC_SUFFIX = ".grpc";
private static final String GRPC_HOST_SUFFIX = ".grpc.host";
private static final String GRPC_PORT_SUFFIX = ".grpc.port";

private static volatile DevServiceConfiguration capturedDevServicesConfig;
private static volatile List<RunningDevService> devServices;
Expand Down Expand Up @@ -261,14 +263,15 @@ private RunningDevService startContainer(DevServicesConfig devServicesConfig, Do
}

// Build the Microcks Host URL + gRPC to put in properties.
String microcksHttpHost = MICROCKS_SCHEME + (hostName != null ? hostName : microcksContainer.getHost())
+ ":" + microcksContainer.getMappedPort(MicrocksContainer.MICROCKS_HTTP_PORT);
String microcksGrpcHost = MICROCKS_SCHEME + (hostName != null ? hostName : microcksContainer.getHost())
+ ":" + microcksContainer.getMappedPort(MicrocksContainer.MICROCKS_GRPC_PORT);
String visiblehost = (hostName != null ? hostName : microcksContainer.getHost());
String microcksHttpHost = MICROCKS_SCHEME + visiblehost + ":" + microcksContainer.getMappedPort(MicrocksContainer.MICROCKS_HTTP_PORT);
String microcksGrpcHost = MICROCKS_SCHEME + visiblehost + ":" + microcksContainer.getMappedPort(MicrocksContainer.MICROCKS_GRPC_PORT);

RunningDevService devService = new RunningDevService(DEV_SERVICE_NAME, microcksContainer.getContainerId(), microcksContainer::close,
Map.of(CONFIG_PREFIX + "default" + HTTP_SUFFIX, microcksHttpHost,
CONFIG_PREFIX + "default" + GRPC_SUFFIX, microcksGrpcHost));
CONFIG_PREFIX + "default" + GRPC_SUFFIX, microcksGrpcHost,
CONFIG_PREFIX + "default" + GRPC_HOST_SUFFIX, visiblehost,
CONFIG_PREFIX + "default" + GRPC_PORT_SUFFIX, microcksContainer.getMappedPort(MicrocksContainer.MICROCKS_GRPC_PORT).toString()));
devServiceMicrocksContainerMap.put(devService, microcksContainer);

return devService;
Expand Down

0 comments on commit ac1e1c3

Please sign in to comment.