Skip to content

Commit ff3f665

Browse files
committed
fix(artillery): update commands to use ARTILLERY_KEY from .env and handle key recording
1 parent c16d129 commit ff3f665

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

packages/artillery/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ nx run artillery:sign-session-key
7373

7474
Generating a report required an API key, you can add that to the root `.env` file. You can find your key at [https://app.artillery.io/](https://app.artillery.io/oivpr8dw4i00f)
7575

76-
```jsx
77-
ARTILLERY_KEY = xxx;
76+
```bash
77+
ARTILLERY_KEY=xxx
7878
```
79+
80+
> ℹ️ The Nx run targets pass `ARTILLERY_KEY` to `artillery run` via `--key`, so no extra flags are needed when running the scripts.

packages/artillery/project.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,35 @@
2222
"executor": "nx:run-commands",
2323
"options": {
2424
"cwd": "{projectRoot}",
25-
"command": "artillery run configs/pkp-sign.yml"
25+
"command": "dotenvx run --env-file=../../.env -- bash -lc 'if [ -n \"$ARTILLERY_KEY\" ]; then artillery run --record --key \"$ARTILLERY_KEY\" configs/pkp-sign.yml; else artillery run configs/pkp-sign.yml; fi'"
2626
}
2727
},
2828
"run:encrypt-decrypt": {
2929
"executor": "nx:run-commands",
3030
"options": {
3131
"cwd": "{projectRoot}",
32-
"command": "artillery run configs/encrypt-decrypt.yml"
32+
"command": "dotenvx run --env-file=../../.env -- bash -lc 'if [ -n \"$ARTILLERY_KEY\" ]; then artillery run --record --key \"$ARTILLERY_KEY\" configs/encrypt-decrypt.yml; else artillery run configs/encrypt-decrypt.yml; fi'"
3333
}
3434
},
3535
"run:execute": {
3636
"executor": "nx:run-commands",
3737
"options": {
3838
"cwd": "{projectRoot}",
39-
"command": "artillery run configs/execute.yml"
39+
"command": "dotenvx run --env-file=../../.env -- bash -lc 'if [ -n \"$ARTILLERY_KEY\" ]; then artillery run --record --key \"$ARTILLERY_KEY\" configs/execute.yml; else artillery run configs/execute.yml; fi'"
4040
}
4141
},
4242
"run:mix": {
4343
"executor": "nx:run-commands",
4444
"options": {
4545
"cwd": "{projectRoot}",
46-
"command": "artillery run configs/mix.yml"
46+
"command": "dotenvx run --env-file=../../.env -- bash -lc 'if [ -n \"$ARTILLERY_KEY\" ]; then artillery run --record --key \"$ARTILLERY_KEY\" configs/mix.yml; else artillery run configs/mix.yml; fi'"
4747
}
4848
},
4949
"run:sign-session-key": {
5050
"executor": "nx:run-commands",
5151
"options": {
5252
"cwd": "{projectRoot}",
53-
"command": "artillery run configs/sign-session-key.yml"
53+
"command": "dotenvx run --env-file=../../.env -- bash -lc 'if [ -n \"$ARTILLERY_KEY\" ]; then artillery run --record --key \"$ARTILLERY_KEY\" configs/sign-session-key.yml; else artillery run configs/sign-session-key.yml; fi'"
5454
}
5555
}
5656
},

0 commit comments

Comments
 (0)