Newman --env-var not being used

Everything I have read so far says this should work. For some reason the ‘base_url’ value is never updated to the value passed in. Is there something obvious I’m missing? Thanks.

newman run https://api.getpostman.com/collections/uuid?apikey=key --environment https://api.getpostman.com/environments/uuid?apikey=key –-env-var base_url=“localhost:5000”

Hey @paulsc

Welcome to the community!! :wave:

The syntax doesn’t look quite right to me, would this work?

--env-var "base_url=localhost:5000"

Just need to ensure that you have a variable in the collection called {{base_url}}.

@dannydainton Thanks for the reply.

I should have mentioned I tried it quoted as you have it with the same result. I have a GET request that references {{base_url}} and hovering over it shows the variables scope as Environment. I also tried setting it as a global and passing it as --global-var with the same result. I must be overlooking something obvious. Thanks.

Have you tried with a variation of variable names?

Try with baseURL or just URL, basically anything without the underscore in the name. Not sure it that’s impacting it but worth a try.

I have a reporter that shows which variables and values are used if that’s any use to you?

You can see the variables by using the --reporter-htmlextra-showEnvironmentData flag.