Environment Variables

.env files can be used to configure properties such as runtime ids, API keys, etc.

What order are .env files loaded in?

When running start, run & up Nitric will automatically load your .env files in the following order.

  1. .env
  2. 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.

NameDescription
NITRIC_STACK_IDThe Stack ID of the project. Example: coolkat-gcp-4c0wg0hg
NITRIC_ENVIRONMENTThe 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).