Local Environment
The Local Environment keeps variable values on your computer, outside your project folder, so they are never committed to Git. Use it for secrets such as API keys, passwords and tokens, and for values that differ for each teammate, such as a personal user ID.
How It Works
- Values are saved in
thunderLocalEnvironment.json, in Thunder Client’s global storage folder on your computer. - The
(Local Env)entry in the environment list is saved astc_env_local.jsonin your environments folder. This file has no values, so it is safe to commit with Git Sync. - The Local Environment is a
globaltype. Its variables are available to all collections and requests, so you don’t need to make it active.
Enable the Local Environment
Open the menu
In the Env tab, click the menu icon next to the filter box.
Add the environment
Select Local Environment. A (Local Env) entry is added to the environment list.
Add variables
Open the Local Environment, add your variables, and save.
You can have only one Local Environment.
Use the Variables
Reference Local Environment variables with {{variable}}, the same as any other environment variable:
GET {{baseUrl}}/users
Authorization: Bearer {{apiKey}}Precedence
- A Local Environment value overrides the same variable in the Global Environment.
- A value in the Active Environment or its linked
.envfile overrides the Local Environment.
See Variable Precedence for the full order.
Link a .env File
You can also link a .env file to the Local Environment. Open the Local Environment, select the Link to .env file checkbox and choose the file.
If a variable is defined in both places, the Local Environment value is used. See Link .env Files for details.
Share With Your Team
- Local Environment values are never shared through Git or Git Sync.
- With Git Sync, teammates see the
(Local Env)entry after they pull. Each teammate opens it and adds their own values. - When you export the Local Environment, its values are included, except values set as
Secret. - Use the same variable names on every machine so that shared requests work for everyone.
Use in the CLI
The Thunder Client CLI reads the Local Environment from the same global storage folder, so tc uses its values on your computer.
The CLI finds this folder from a path that the Thunder Client extension saves. Open Thunder Client in your IDE at least once before you run tc:
tc --col 'colNameOrId'CI/CD
The Local Environment is not available on CI/CD machines. Pass the values with --var-data instead:
tc --col 'colNameOrId' --var-data "apiKey=$API_KEY"Compare With Other Options
To compare the Local Environment with .env files and Secret Managers, see Storing Secrets.