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.