Skip to content

Commit 3a26686

Browse files
feat: add secret management (#628)
Signed-off-by: Asish Kumar <[email protected]>
1 parent 85b5eda commit 3a26686

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

versioned_docs/version-3.0.0/running-keploy/configuration-file.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,28 @@ The tests section enables you to specify conditions for recording tests during A
238238

239239
You can use the **`path`**, **`urlMethods`**, **`headers`**, and **`host`** filters together or independently based on your testing scenarios. This flexibility allows you to precisely define the conditions under which tests are recorded.
240240

241+
### Managing Secrets with `secret.yaml`
242+
243+
Keploy allows you to manage sensitive information like API keys or tokens securely, without hardcoding them into your test files. This is done using a `secret.yaml` file within each test set directory.
244+
245+
1. **Create `secret.yaml`**: Inside your test set directory (e.g., `keploy/test-set-0/`), create a file named `secret.yaml`.
246+
247+
2. **Define Your Secrets**: Add your secrets as key-value pairs.
248+
249+
```yaml
250+
Authorization: Bearer xyz.abc.123
251+
```
252+
253+
3. **Use Secrets in Tests**: Reference these values in your test cases or mocks using the `{{.secret.KEY}}` syntax.
254+
`yaml
255+
# inside a test-case.yaml
256+
...
257+
header:
258+
Authorization: '{{string .secret.Authorization }}'
259+
...
260+
`
261+
For your security, Keploy will automatically add `/*/secret.yaml` to your `.gitignore` file to prevent accidentally committing secrets.
262+
241263
### Bypass Rules Section
242264

243265
The `bypassRules` section in the Keploy-config file allows you to define parameters for bypassing and mocking API calls.

0 commit comments

Comments
 (0)