Environment Variables

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

Note: If you're looking for more secure ways to store values you might consider the secrets manager or in an object store.

What order are .env files loaded in?

Nitric will automatically load your .env files in the following order.

nitric run
  1. .env
  2. .env.development
  3. any file you pass in via "--env-file"
nitric up
  1. .env
  2. .env.production
  3. any file you pass in via "--env-file"

Values in .env are overwritten by .env.development if it exists and so forth. Options 1 & 2 must be stored in the root directory of your project.