As a workaround, I can suggest setting the output data from an environment variable, and using the same environment variable in the k6 script.
k6 run --out influxdb="http://localhost:8086/$MY_ENV_VAR" script.js
and then using
script.js. Just don’t forget to specify
--include-system-env-vars if you’re using
k6 cloud, since by default it’s only enabled for
k6 run, to prevent unintentional data leaks.
I still don’t understand your exact use case, but considering you can use these environment variables both in your script and to affect the other exported
options, and you can combine that with extra per-scenario environment variables, I think there’s not a lot that can’t be done with this much flexibility.