Skip to content

aea.helpers.env_vars

Implementation of the environment variables support.

is_env_variable

def is_env_variable(value: Any) -> bool

Check is variable string with env variable pattern.

export_path_to_env_var_string

def export_path_to_env_var_string(export_path: List[str]) -> str

Conver export path to environment variable string.

parse_list

def parse_list(var_prefix: str, env_variables: dict) -> str

Parse list object.

replace_with_env_var

def replace_with_env_var(value: str,
                         env_variables: dict,
                         default_value: Any = NotSet,
                         default_var_name: Optional[str] = None) -> JSON_TYPES

Replace env var with value.

apply_env_variables

def apply_env_variables(data: Union[Dict, List[Dict]],
                        env_variables: Mapping[str, Any],
                        path: Optional[List[str]] = None,
                        default_value: Any = NotSet) -> JSON_TYPES

Create new resulting dict with env variables applied.

convert_value_str_to_type

def convert_value_str_to_type(value: str, type_str: str) -> JSON_TYPES

Convert value by type name to native python type.

apply_env_variables_on_agent_config

def apply_env_variables_on_agent_config(
        data: List[Dict], env_variables: Mapping[str, Any]) -> List[Dict]

Create new resulting dict with env variables applied.

is_strict_list

def is_strict_list(data: Union[List, Tuple]) -> bool

Check if a data list is an strict list

The data list contains a mapping object we need to process it as an object containing configurable parameters. For example

cert_requests: - public_key: example_public_key

This will get exported as CONNECTION_NAME_CERT_REQUESTS_0_PUBLIC_KEY=example_public_key

Where as

parameters: - hello - world

will get exported as SKILL_NAME_PARAMETERS=["hello", "world"]

Arguments:

  • data: Data list

Returns:

Boolean specifying whether it's a strict list or not

generate_env_vars_recursively

def generate_env_vars_recursively(data: Union[Dict, List],
                                  export_path: List[str]) -> Dict

Generate environment variables recursively.