Env file support

Abstract

Description of the JSS CLI support for .env files

The JSS CLI supports loading environment variables from .env files that can be used to populate environment variables.

Variables are loaded from .env files with the following priority:

  • .env.${NODE_ENV}.local.

  • .env.local, unless the value of NODE_ENV is "test".

  • .env.${NODE_ENV}.

  • .env.

The CLI automatically expands variables inside of your .env* files. This allows you to reference other values. If you are attempting to use a $ in a variable value, it needs to be escaped with a backslash \. For example:

PASSWORD=b

# becomes 'adminb'
EXPANDED=admin$PASSWORD

# becomes 'admin$PASSWORD'
ESCAPED=admin\$PASSWORD