@absolunet/ioc2.1.0

View on GitHub

EnvironmentRepository

Environment repository that exposes all environment variables.

Members

(static) dependencies :Array.<string>

Source:
Class dependencies: ['app', 'evaluator'].

Methods

setFromFile(file)

Source:
Set environment values from given file.
Parameters:
Name Type Description
file string The .env file to load the specific environment variable from.

all()

Source:
Get all loaded environment variables.
Returns:
The environment variables.
Type
object.<string, *>

get(key, defaultValueopt)

Source:
Get single environment variable. Value will be automatically cast as null, a boolean, a number or a string. The first valid value will be returned.
Parameters:
Name Type Attributes Default Description
key string The environment variable name.
defaultValue null | boolean | number | string <optional>
null The default value to use if the environment variable is not defined.
Returns:
The environment variable value.
Type
boolean | null | number | string

has(key)

Source:
Check if environment variable was defined.
Parameters:
Name Type Description
key string The environment variable name.
Returns:
Indicates if the variable exists in environment.
Type
boolean