Last active
October 31, 2025 11:35
-
-
Save hassy/0b31984e9f6dc7433c2d2c60150bd416 to your computer and use it in GitHub Desktop.
Changing config dynamically based on an env var
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const config = { | |
| target: 'https://localhost:1345' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const config = { | |
| target: 'http://asciiart.artillery.io:8080' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The --config option to import config from a separate file only works with YAML files (see https://www.artillery.io/docs/reference/cli/run#extract-and-reuse-configuration) | |
| // This example shows how import() calls can be used to change config dynamically in a TypeScript/JS Artillery script. | |
| // To run this test with the dev config, run: | |
| // IS_DEV=true artillery run main.ts | |
| // If IS_DEV is not set, the prod config will be used. | |
| import { config as configProd } from './config-prod'; | |
| import { config as configDev } from './config-dev'; | |
| export const config = process.env.IS_DEV ? configDev : configProd; | |
| export const scenarios = [ | |
| { | |
| flow: [ | |
| { | |
| get: { | |
| url: "/pony", | |
| }, | |
| }, | |
| ], | |
| }, | |
| ]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment