https://linen.dev logo
#help
Title
# help
c

Chris Connor

02/23/2024, 8:32 AM
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

Tom

02/23/2024, 10:24 AM
Yes, the idea is that it’ll treat WIREMOCK_* env vars as safe by default, but anything else needs to be explicitly approved
c

Chris Connor

02/23/2024, 10:38 AM
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

Tom

02/23/2024, 10:40 AM
I’m pretty certain you need to use the full key, but that is off the top of my head
c

Chris Connor

02/23/2024, 10:57 AM
Awesome; thanks as always Tom 😎 I was probably doing something daft yesterday
4 Views