EnvironmentVariables
Table of Contents
Methods
default
-
name
-
value
Set a default value for an environment variable if it does not exist
Parameters:
-
name
StringThe name of the environment variable
-
value
StringThe default value
Returns:
The value of the existing or newly set environment variable
default
-
name
Substitute the value of other environment variables into the named one.
For example:
process.env.MAJOR_VERSION = "0";
process.env.MINOR_VERSION = "3";
EnvironmentVariables.substitute('api/.');
... will return 'api/0.3'
;
Note that if this is done for multiple environment variables, the order in which they are done will affect the result. It is the responsibility of the caller to this function to ensure that the values to be substituted in are already fully resolved: this function is not recursive. Therefore, cycles are also not allowed. Any of these will result in indeterminate results, including errors.
Parameters:
-
name
StringThe name of the environment variable
Returns:
The value of the existing or newly set environment variable
exists
-
name
Test that an environment variable exists
Parameters:
-
name
StringThe name of the environment variable
Returns:
true
when environment variable is defined and is not an empty string
require
-
name
Enforce that an environment variable exists
Parameters:
-
name
StringThe name of the environment variable