Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional default for SystemValueHelper. #2630

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

kyle-winkelman
Copy link
Contributor

@kyle-winkelman kyle-winkelman commented Mar 8, 2024

Allow an optional default value to be supplied when using the systemValue helper.

An example where this might be useful is having a safe default to proxy to a dev environment without requiring the environment variable to be set. It is also helpful to demonstrate what an appropriate value for the environment variable should be.

{
    "request": {
        "method": "ANY",
        "urlPattern": "/"
    },
    "response": {
        "proxyBaseUrl": "{{systemValue type='ENVIRONMENT' key='WIREMOCK_PROXY_BASE_URL', default='https://dev.example.com'}}",
        "transformers": [
            "response-template"
        ]
    }
}

References

Submitter checklist

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

@kyle-winkelman kyle-winkelman requested a review from a team as a code owner March 8, 2024 16:04
@dieppa dieppa self-assigned this Mar 25, 2024
@dieppa dieppa merged commit 0be4b07 into wiremock:master Mar 25, 2024
7 checks passed
@dieppa
Copy link
Contributor

dieppa commented Mar 25, 2024

Thanks! It has been merged

@kyle-winkelman kyle-winkelman deleted the systemValueHelperDefault branch March 26, 2024 15:05
@kyle-winkelman
Copy link
Contributor Author

Did you see the correspond PR for wiremock.org documentation?

wiremock/wiremock.org#262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants