config:
target: "https://some-site.com"
This my current setup. the target is static. I want to make it variable, either through a command line argument or environment argument.
For Example:
config:
target: "{{ target_site }}"
Three options:
processEnvironment
Use $processEnvironment
to get a variable from an environment variable:
config:
target: "{{ $processEnvironment.TARGET_URL }}"
And run with TARGET_URL=https://some-site.com artillery run scenario.yml
--variables
Define your YAML like this:
config:
target: "{{ targetUrl }}"
And then run your scenario by passing in the targetUrl
variable:
artillery run scenario.yml --variables '{ "targetUrl": "https://some-site.com" }'
--dotenv
Create a .env
file with the URL:
TARGET_URL=https://some-site.com
Then, create your scenario as in the first option.
Finally, run your scenario with:
artillery run scenario.yml --dotenv <path_to_dotenv_file>