Skip to content

Commit aa76836

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

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,29 @@ 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+
# path: keploy/test-set-0/secret.yaml
250+
API_KEY: "your-super-secret-api-key"
251+
AUTH_TOKEN: "bearer-token-xyz-123"
252+
```
253+
254+
3. **Use Secrets in Tests**: Reference these values in your test cases or mocks using the `{{.secret.KEY}}` syntax.
255+
```yaml
256+
# inside a test-case.yaml
257+
...
258+
header:
259+
Authorization: "Bearer {{ .secret.AUTH_TOKEN }}"
260+
...
261+
```
262+
For your security, Keploy will automatically add `/*/secret.yaml` to your `.gitignore` file to prevent accidentally committing secrets.
263+
241264
### Bypass Rules Section
242265

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

379402
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.
380403

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

0 commit comments

Comments
 (0)