Constructor
new EnvironmentUtils()
- Source:
- Tutorials:
Members
development :boolean
- Source:
Whether or not the environment is for development.
Type:
Methods
exists(name) → {boolean}
- Source:
Checks whether an environment variable exists or not.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the variable. |
Returns:
- Type
- boolean
get(name, defaultValueopt, requiredopt) → {string}
- Source:
Gets the value of an environment variable.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | The name of the variable. |
||
defaultValue |
string |
<optional> |
''
|
A fallback value in case the variable is
|
required |
boolean |
<optional> |
false
|
If the variable is required and |
Throws:
-
If
required
is set totrue
and the variable isundefined
. - Type
- Error
Returns:
- Type
- string
set(name, value, overwriteopt) → {boolean}
- Source:
Sets the value of an environment variable.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | The name of the variable. |
||
value |
string | The value of the variable. |
||
overwrite |
string |
<optional> |
false
|
If the variable already exists, the method won't
overwrite it, unless you set this parameter to
|
Returns:
Whether or not the variable was set.
- Type
- boolean