From ac1e1c30b73b21ef8cb1eafd46162bd1d802cc7f Mon Sep 17 00:00:00 2001 From: Laurent Broudoux Date: Tue, 24 Oct 2023 15:14:01 +0200 Subject: [PATCH] feat: #11 Add 2 more properties, splitting grpc host and port Signed-off-by: Laurent Broudoux --- .../deployment/DevServicesMicrocksProcessor.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/deployment/src/main/java/io/github/microcks/quarkus/deployment/DevServicesMicrocksProcessor.java b/deployment/src/main/java/io/github/microcks/quarkus/deployment/DevServicesMicrocksProcessor.java index 6afd47a..007cff3 100644 --- a/deployment/src/main/java/io/github/microcks/quarkus/deployment/DevServicesMicrocksProcessor.java +++ b/deployment/src/main/java/io/github/microcks/quarkus/deployment/DevServicesMicrocksProcessor.java @@ -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 devServices; @@ -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;