getenv_bool#

caf.toolkit.arguments.getenv_bool(name, default)[source]#

Get environment variable and converts to a boolean.

Normalizes the variable value by converting to lowercase and stripping whitespace before bool conversion.

Parameters:
  • name (str) – Name of the environment variable.

  • default (bool) – Default value for the environment variable.

Returns:

True for: ‘true’, ‘yes’, ‘y’ or ‘1’. False for: ‘false’, ‘no’, ‘n’ or ‘0’.

Return type:

bool

Raises:

ValueError – If the environment variable has an unexpected value.