1

For example, I want to start wiremock standalone with hostname "my.abc.com" with port 9999. Where can I config that? Or what is the right command line options for hostname? Thanks a lot in advance.

Sifeng
  • 713
  • 9
  • 23

1 Answers1

3

The hostname is determined by DNS or your host file, rather than WireMock itself.

If you want to run everything locally but with a hostname other than localhost you can edit your hosts file and add a line like:

127.0.0.1 api.mydomain.com

Then you can hit a locally running WireMock server on e.g. http://api.mydomain.com:9999/

As agoff points out, if you want to use the Java DSL against the instance you need to configure it:

WireMock.configureFor("api.mydomain.com", 9999);

The host file can be found in the following places: Windows - c:\Windows\System32\Drivers\etc\hosts

Mac - /private/etc/hosts

*nix - /etc/hosts

Tom
  • 3,471
  • 21
  • 14