Getting Access
Contact the WireMock team to request a license file, which should be placed in the appropriate configuration location for your operating system:- Windows:
%LOCALAPPDATA%\wiremock-cli(typicallyC:\Users\{username}\AppData\Local\wiremock-cli) - macOs:
/Users/{username}/.config/wiremock-cli - Linux:
$XDG_CONFIG_HOME/wiremock-cli(typically/home/{username}/.config/wiremock-cli)
Usage
First you will need to pull one or more of your Mock APIs locally. This can be done by running thepull mock-api
command as detailed here.
Once you have pulled one or more of your Mock APIs, you can then run them as so:
.wiremock directory. A table will be printed showing you
which port is being used for which API.
(Naturally you can pass the same --wiremock-dir argument to override the default .wiremock directory.)
TLS Usage
You can run your Mock APIs locally using a TLS certificate of your choice. You configure this by editing the local environment config file,.wiremock/wiremock.yaml, and specifying your https settings:
https section will then use that certificate by default.
You may still provide a specific certificate for any individual service:
Running in a Container
The CLI is published to Docker Hub aswiremock/wiremock-cli. By
default, it executes the run command, but in order for the run command to be able to operate you must mount your
config directory to /etc/wiremock-cli and the working directory containing your mock APIs to /work.
You will also need to publish the appropriate ports
for the services you are running.
Here is a typical example on Linux or macOs when running two Mock APIs:
Telemetry
Thewiremock run command can be configured to export OpenTelemetry signals to a backend of your choice.
Configuration is done via environment variables, as specified by the OpenTelemetry specification.
For example, to emit logs to a backend that supports OTLP
at the endpoint https://my-telemetry-service:8080, set the following environment variables:
OTEL_LOGS_EXPORTER=otlp.OTEL_EXPORTER_OTLP_ENDPOINT=https://my-telemetry-service:8080.
OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, OTEL_LOGS_EXPORTER are:
otlp: OTLPconsole: Standard Outputnone: No automatically configured exporter.
OTEL_TRACES_EXPORTER,
OTEL_METRICS_EXPORTER, and OTEL_LOGS_EXPORTER, which are all set to none by default, rather than otlp.
These telemetry options also apply to the WireMock Runner’s serve mode.