Skip to content

Conversation

@TheRealGuru
Copy link
Contributor

…r configuration

Currently it is impossible to configure SSL, rather than go through all the hoops to add proper configuration for SSL I've applied this hotfix. By using addExposedPort we do not override the user configuration. Currently if I was to do the following:

  WireMockContainer wiremockServer = new WireMockContainer("wiremock/wiremock:2.35.0").withExposedPorts(8443);

This would never bind 8443 because when the container is started the configure also calls withExposedPorts, therefore overriding the user configured values.

This means we cannot configure SSL as we need a port for HTTP and HTTPS.

For testing I simply exposed an additional port to test that this would no longer override that port - this test if tried without the code change will fail. This confirms that the code is working as expected.

References

#164

Submitter checklist

  • Recommended: Join WireMock Slack to get any help in #help-contributing or a project-specific channel like #wiremock-java
  • [ x ] The PR request is well described and justified, including the body and the references
  • [ x ] The PR title represents the desired changelog entry
  • [ x ] The repository's code style is followed (see the contributing guide)
  • [ x ] Test coverage that demonstrates that the change works as expected
  • [ x ] For new features, there's necessary documentation in this pull request or in a subsequent PR to wiremock.org

@TheRealGuru TheRealGuru changed the title fix: Use addExposedPort instead of setExposedPort which overrides use… fix: Use addExposedPort instead of setExposedPort which overrides user configuration Jan 9, 2025
@TheRealGuru
Copy link
Contributor Author

@oleg-nenashev Could you please merge this in? Its a very simple change that stops it from automatically overriding port.

@oleg-nenashev oleg-nenashev self-assigned this Mar 19, 2025
@oleg-nenashev
Copy link
Member

Hi. Sorry for the delay. I will look into it and other PRs - paternity leave

@oleg-nenashev oleg-nenashev added the bug Something isn't working label Mar 20, 2025
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked it this morning, works on my machine. LGTM

@oleg-nenashev oleg-nenashev merged commit bfc0166 into wiremock:main Mar 30, 2025
@oleg-nenashev oleg-nenashev changed the title fix: Use addExposedPort instead of setExposedPort which overrides user configuration Use addExposedPort instead of setExposedPort which overrides user configuration Mar 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants