Environment Variables
.env files can be used to configure properties such as runtime ids, API keys, etc.
If you're looking for more secure ways to store values you might consider the secrets manager or an object store.
What order are .env
files loaded in?
When running start
, run
& up
Nitric will automatically load your .env files in the following order.
- .env
- any file you pass in via "--env-file"
Values in the default .env are overwritten by additional env files.
System Environment Variables
If you are running your project in the cloud, build, or the run environment, Nitric provides prefixed Environment Variables, which you can find in the table below.
Name | Description |
---|---|
NITRIC_STACK_ID | The Stack ID of the project. Example: coolkat-gcp-4c0wg0hg |
NITRIC_ENVIRONMENT | The Environment that the app is running on. The value can be either cloud (for deployed in the cloud), run (for stacks running in nitric run), or build (for stack code running during the deployment gathering phase). |