Env file support

Version:

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
If you have suggestions for improving this article, let us know!