Hi team,
How can I read a specific environment config file and pass that environment as a CLI flag?
I found this but it doesn’t extend to having multiple environments:
Let’s say I have the following environment json files:
env/preprod.json
env/stage.json
In my sample script.js
, it should contain something like:
var r = http.get(
http://${__ENV.HOST.BASE_URL}/); // <- This BASE_URL is inside the JSON files above and will change depending on the environment I chose
So, when I tried this on the CLI:
k6 run -e HOST=".env/preprod.json" script.js
I get an error ‘cannot read property’…