Skip to content

Commit b5ec6fc

Browse files
feat: add secret management
Signed-off-by: Asish Kumar <[email protected]>
1 parent 85b5eda commit b5ec6fc

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,27 @@ 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+
```yaml
249+
Authorization: Bearer xyz.abc.123
250+
```
251+
252+
3. **Use Secrets in Tests**: Reference these values in your test cases or mocks using the `{{.secret.KEY}}` syntax.
253+
```yaml
254+
# inside a test-case.yaml
255+
...
256+
header:
257+
Authorization: '{{string .secret.Authorization }}'
258+
...
259+
```
260+
For your security, Keploy will automatically add `/*/secret.yaml` to your `.gitignore` file to prevent accidentally committing secrets.
261+
241262
### Bypass Rules Section
242263

243264
The `bypassRules` section in the Keploy-config file allows you to define parameters for bypassing and mocking API calls.
@@ -378,4 +399,4 @@ Congratulations! You've now explored the features and configuration options prov
378399

379400
Now armed with Keploy-config, you are ready to embark on a more organized and productive journey of recording and testing APIs with Keploy. Feel free to explore additional features, customize configurations, and refer to the [CLI Command Docs](http://keploy.io/docs/running-keploy/cli-commands/) for more details on available flags and parameters.
380401

381-
Happy testing and may your APIs always return the expected results! 🚀
402+
Happy testing and may your APIs always return the expected results! 🚀

0 commit comments

Comments
 (0)