Morning folks; got a quick query on the <templatin...
# help
c
Morning folks; got a quick query on the templating documentation; particularly outputting environment variables in a response body. I’ve been messing around with the standalone version on Docker; and I can get it working by • Exposing an env var when running the image
-e BASE_URL='<http://production.google.com|production.google.com>'
• Had a matching rule with
"baseURL": "{{systemValue type='ENVIRONMENT' key='BASE_URL'}}",
in the response • Made sure the container had access to it
--permitted-system-keys "BASE_URL"
Do we always need to specify a list of
permitted-system-keys
? There is a line at the end of the docs which says > If no permitted system key patterns are set, a single default of
wiremock.*
will be used.
Does that mean we can prefix env variables without explicitly adding them to the permitted-system-keys list? Or am I mixing up different things here 🙂 it has been known to happen… Thanks in advance 🙌
t
Yes, the idea is that it’ll treat WIREMOCK_* env vars as safe by default, but anything else needs to be explicitly approved
c
Ahh ok that’s kinda what I thought but couldn’t get that to work. Can I just double check; in my example, if I exposed the env var like so:
-e WIREMOCK_BASE_URL='<http://production.google.com|production.google.com>'
Would the response body then expect
"baseURL": "{{systemValue type='ENVIRONMENT' key='BASE_URL'}}"
or
"baseURL": "{{systemValue type='ENVIRONMENT' key='WIREMOCK_BASE_URL'}}"
I can experiment further; just incase you know off the top of your head 🙏
t
I’m pretty certain you need to use the full key, but that is off the top of my head
c
Awesome; thanks as always Tom 😎 I was probably doing something daft yesterday