Features
Environments

Environments


Thunder Client Environment Variables

Common Variables: The following variables are available for all the requests {{request_name}}, {{collection_name}} and {{folder_name}}

The following environments can be used in Thunder Client, ranked from least to highest precedence:

  1. OS Environment Variables:
    You can reference OS system environment variables as global variables using the format {{variable}}.
  2. *Global Environment:
    Global Environment allows you to store variables that can be accessed across all collections. These values are saved in the file tc_env_global.json file. (Refer to the image above, option 2).
  3. *Local Environment:
    You can use Local Environment to save secrets and transient tokens locally on your computer; useful to exclude secrets from a git project. This environment is a global type and the variables are available to all collections. (Refer to the image above, option 3)
  4. *env files:
    You can use .env files in Thunder Client. To use a .env file follow the below steps:
    • Create an Environment (using option 1 in above image).
    • Open the Environment view, where you will see the option Link to .env file.
    • Select the .env file and save it. Now you can use the variables in Requests using {{variable}}.
    • The variables in the .env file should be in the format:
    .env.sample
    key=value
    name=thunder
    number=25543
  5. Active Environment:
    To use an environment's variables, you need to make it active using the options menu ..., then select Set Active.
  6. Attach Env to Collection (Optional):
    You can attach an environment to a collection from the Collection Settings view. Use this option when you'd like to link multiple collections to multiple environments. The values in this environment will take precedence over the active environment. If you change environments frequently, this option is not recommended. Please see the example below:
    CollectionA -> EnvA
    CollectionB -> EnvB
    CollectionC -> EnvC
  7. *Collection and Request Variables
  • You can set collection and request specific env variables in scripting using request scope.
  • These variable values are available during the execution of the request only.
  • To use - open collection settings or request view -> then select Pre Run Tab and use the Scripting tab
tc.setVar("name", "Thunder Client", "request");
tc.setVar("baseUrl", "http://localhost:8744", "request");
* These features are available only in the paid version.

How to use Environment Variables

  • To use environment variables use the format {{variableName}}. You can use variables in Query Params, Headers, Body & Tests.

Import .env Files

This feature is available only in the paid version..
  • You can import Thunder Client, Postman and .env files using the Import Menu Option (see above image, option 4). More details here.

Set Environment Variable

  • Setting Environment variables is supported in the Tests tab using UI and scripting.
  • Please see the documentation here.

Encrypted Environments

This feature is available in the Enterprise Plan.
  • The environment variable values are stored in JSON files in plain text format. The encrypted environment feature will save variable values in an encrypted format, useful for additional security.

Plain Text Values:

  • The values will be stored in the environment file in plain text format (Free, Starter & Business Plan).
tc_env_staging.json
{
   "name": "color",
   "value": "red",
   "secret": true,
}

Encrypted Values:

  • The values will be stored in the environment file in an encrypted format (Enterprise Plan).
  • To save values in encrypted format, set the variable as a Secret in the Environment UI using the lock icon Lock.
tc_env_staging.json
{
   "name": "color",
   "value": "F4cuC3C1bmjrhpbG0uDj8A",
   "secret": true,
   "encrypted": true
}

Integration with Secret Managers

This feature is available in the Enterprise Plan.
  • Thunder Client integrates with secret managers like Azure Key Vault and AWS Secrets Manager to fetch secrets and use variables in your requests with the format {{variable}}.

Secrets

Azure Key Vault

  • Thunder Client integrates with Azure Key Vault to fetch secrets and use them in your requests.
  • Set the variable TC_AZURE_VAULT_URL in your staging and production environments, and Thunder Client will automatically retrieve secrets from Azure Key Vault.
VariableSample Value
TC_AZURE_VAULT_URL

https://myvault.vault.azure.net/

AWS Secrets Manager

  • Thunder Client integrates with AWS Secrets Manager to fetch secrets and use them in your requests.
  • Set the TC_AWS_SECRET_NAME and TC_AWS_REGION variables in your staging and production environments, and Thunder Client will automatically retrieve secrets from AWS Secrets Manager.
VariableSample Value
TC_AWS_SECRET_NAMEmy-secrets
TC_AWS_REGIONus-west-1

Authentication

  • Thunder Client uses the default credentials from the environment to authenticate with the secret managers. Use the Azure CLI or AWS CLI to set the credentials.

Logs

  • The logs will show errors if there are any issues with fetching the secrets from the secret managers.