Using multiple cloud accounts

I have two k6 cloud accounts one for my personal use and the other one for the company I’m working for. I wonder how I could switch between accounts depending on the directory I’m currently at?

for example with git you can achieve it by adding the following code to your ~/.gitconfig

[includeIf “gitdir:~/code/personal/”]
path = .gitconfig-personal
[includeIf “gitdir:~/code/work/”]
path = .gitconfig-work

Maybe it is possible to dynamically set the path to a config file or cloud token using an ENV variable?

Sorry for the late reply, this somehow got lost in the cracks… :disappointed:

Yes, you can easily switch between personal and company accounts for k6 cloud tests. You can do that by just assigning different ext.loadimpact.token and ext.loadimpact.projectID values in your script options, see Token and Cloud tests from the CLI

Alternatively you can have different JSON configs with those values and use them with the --config flag. And finally, you can also use the K6_CLOUD_TOKEN and K6_CLOUD_PROJECT_ID environment variables to configure these things.