Search code examples
karate

Managing Secrets in Karate


I am looking for a way to manage: (keep, use, update) secrets in Karate framework. In my Python and node frameworks I have been using .env file for that task + some classes/methods to retrieve the secrets from a secure place, update the .env file etc.

What's the best way to do this in Karate?

These are the requirements:

  1. User should be able to use CLI to provide the secrets
  2. If no secrets provided, a default value should be used
  3. Values are different based on the env

Thank you


Solution

  • The whole point of karate-config.js is to manage all config variables dynamically. Refer to the docs: https://github.com/karatelabs/karate#switching-the-environment

    If you have secrets that you don't want checked into source control, you can suck them in from the CLI or System environment: https://stackoverflow.com/a/57261852/143475