Storing Secrets
Environment variable values are saved in JSON files in plain text. With Git Sync, these files are saved in your project and committed to Git, so anyone with access to the repository can read them. Keep API keys, passwords and tokens out of these files.
Options
Use one of these options for API keys, passwords and tokens:
- Local Environment: keep secrets on your computer, out of your project and Git.
- .env file: keep secrets in a
.envfile and add it to.gitignore. - Secret Managers (Enterprise): load secrets at run time from Azure Key Vault or AWS Secrets Manager.
Compare the Options
| Local Environment | .env File | Secret Managers | |
|---|---|---|---|
| Where values are stored | Thunder Client’s global storage on your computer | A file you choose, usually in your project | Azure Key Vault or AWS Secrets Manager |
| Kept out of Git | Always | Only if you add the file to .gitignore | Always |
| Share with your team | Each teammate adds their own values | Each teammate creates their own file | Access is managed in your cloud account |
| CI/CD | Not available | Works with the CLI | Needs a cloud login on the build machine |
| Price Plan | Paid | All plans | Enterprise |
CI/CD
A CI/CD machine has no Local Environment. Store secrets in your CI/CD tool’s secret store, then pass them to the Thunder Client CLI in one of these ways:
- Write them to a
.envfile during the build and link that file to the environment. See CI/CD. - Pass them with
--var-data:
tc --col 'colNameOrId' --var-data "apiKey=$API_KEY"Best Practices
- Use the same variable names on every machine, such as
{{apiKey}}, so shared requests work for everyone. - Add
.envfiles to.gitignorebefore you add any secrets to them. - Never commit secret values to Git or share them in chat or email.
- If a secret is committed to Git, rotate it. Removing it from the repository does not remove it from Git history.
Last updated on