Skip to content

Instantly share code, notes, and snippets.

@hassy
Last active October 31, 2025 11:35
Show Gist options
  • Save hassy/0b31984e9f6dc7433c2d2c60150bd416 to your computer and use it in GitHub Desktop.
Save hassy/0b31984e9f6dc7433c2d2c60150bd416 to your computer and use it in GitHub Desktop.
Changing config dynamically based on an env var
export const config = {
target: 'https://localhost:1345'
}
export const config = {
target: 'http://asciiart.artillery.io:8080'
}
// 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