https://linen.dev logo
#general
Title
# general
a

Akhilesh Chaikam

07/25/2023, 7:02 AM
Hi Team, I've been trying to pass this option
--global-response-templating
to wiremock using env variable in pom.xml. But still I'm not able to get it working, my wiremock doesnt replace the
{{request.host}}
in mocked response with
localhost
value. I'm not sure what I'm missing. Wiremock image is running at
8080
port inside the docker container which is mapped to
8181
in my machine. It is able to receive the request but this option
--global-response-templating
isnt working. Can someone please help me if I'm setting this incorrectly ? Have tried everything but no luck.
Copy code
<env>
                                    <WIREMOCK_COMMANDLINE_OPTIONS>
                                        --port 8080
                                        --global-response-templating
                                        --max-request-journal-entries 1000
                                    </WIREMOCK_COMMANDLINE_OPTIONS>
                                </env>
                                <ports>
                                    <port>+wiremock.host.address:wiremock.host.port:8080</port>
                                </ports>
And here is how, I'm starting the docker containers.
Copy code
mvn -X docker:build docker:start -pl container-tests -DSOURCE_DIRECTORY=`pwd` -DskipTests -Ddocker.follow \
  -Dsqs.host.port=9324 \
  -Dwiremock.host.port=8181 \
  -Dims.port=8080 \
  -Dpostgresmock.host.port=5432
o

Oleg Nenashev

07/25/2023, 11:17 AM
Hi. Which version of WireMock do you use?
Asking, because https://github.com/wiremock/wiremock/pull/2238 changed the implementation of the templating engine, and some behavior might have changed. So triage is needed. FYI @Tom P.S: it's not often to see the Maven Docker Plugin in the wild. Is it the fabric8 one? If you triage, one of the first steps would be to ensure that the parameter is actually propagated
a

Akhilesh Chaikam

07/25/2023, 5:15 PM
Thanks oleg for kind response, I'm using wiremock
2.35.0
I will go through the given links. Thanks.
Hi @Oleg Nenashev, I also found that my wiremock always run at port
8080
inside docker. And I see that my command arguments are present in wiremock tab in docker app. (Please see attached image). But still none of those arguments are honored. For eg:
--verbose
doesnt enable verbose logging. It still says verbose as
false
in output.
Never mind, I just changed
WIREMOCK_COMMANDLINE_OPTIONS
to
cmd
and it worked 🙂. Thanks.
Copy code
<cmd>--port 8181 --verbose --global-response-templating</cmd>
👍 1
o

Oleg Nenashev

07/25/2023, 6:45 PM
Did you find this environment variable somewhere in the docs?
If you would be interested to write a short article about running WireMock from the Maven Docker plugin (use-cases and how-to's), it would be awesome too!
👍 1
15 Views