aea.configurations.manager
Implementation of the AgentConfigManager.
VariableDoesNotExist Objects
Variable does not exist in a config exception.
handle_
dotted_
path
handle_dotted_path(value: str, author: str, aea_project_path: Union[str, Path] = ".") -> Tuple[List[str], Path, ConfigLoader, Optional[ComponentId]]
Separate the path between path to resource and json path to attribute.
Allowed values: 'agent.an_attribute_name' 'protocols.my_protocol.an_attribute_name' 'connections.my_connection.an_attribute_name' 'contracts.my_contract.an_attribute_name' 'skills.my_skill.an_attribute_name' 'vendor.author.[protocols|contracts|connections|skills].package_name.attribute_name
We also return the component id to retrieve the configuration of a specific component. Notice that at this point we don't know the version, so we put 'latest' as version, but later we will ignore it because we will filter with only the component prefix (i.e. the triple type, author and name).
Arguments:
value
: dotted path.author
: the author string.aea_project_path
: project path
Returns:
Tuple[list of settings dict keys, filepath, config loader, component id].
find_
component_
directory_
from_
component_
id
find_component_directory_from_component_id(aea_project_directory: Path, component_id: ComponentId) -> Path
Find a component directory from component id.
AgentConfigManager Objects
AeaConfig manager.
__
init__
| __init__(agent_config: AgentConfig, aea_project_directory: Union[str, Path], env_vars_friendly: bool = False) -> None
Init manager.
Arguments:
agent_config
: AgentConfig to manage.aea_project_directory
: directory where project for agent_config placed.env_vars_friendly
: whether or not it is env vars friendly
load_
component_
configuration
| load_component_configuration(component_id: ComponentId, skip_consistency_check: bool = True) -> ComponentConfiguration
Load component configuration from the project directory.
Arguments:
component_id
: Id of the component to load config for.skip_consistency_check
: bool.
Returns:
ComponentConfiguration
agent_
config_
file_
path
Return agent config file path.
load
| @classmethod
| load(cls, aea_project_path: Union[Path, str], substitude_env_vars: bool = False) -> "AgentConfigManager"
Create AgentConfigManager instance from agent project path.
set_
variable
Set config variable.
Arguments:
path
: str dotted path or List[Union[ComponentId, str]]value
: one of the json friendly objects.
get_
variable
Set config variable.
Arguments:
path
: str dotted path or List[Union[ComponentId, str]]
Returns:
json friendly value.
update_
config
Apply overrides for agent config.
Validates and applies agent config and component overrides. Does not save it on the disc!
Arguments:
overrides
: overridden values dictionary
Returns:
None
validate_
current_
config
Check is current config valid.
json
Return current agent config json representation.
dump_
config
Save agent config on the disc.
verify_
private_
keys
| @classmethod
| verify_private_keys(cls, aea_project_path: Union[Path, str], private_key_helper: Callable[[AgentConfig, Path, Optional[str]], None], substitude_env_vars: bool = False, password: Optional[str] = None) -> "AgentConfigManager"
Verify private keys.
Does not saves the config! Use AgentConfigManager.dump_config()
Arguments:
aea_project_path
: path to an AEA project.private_key_helper
: private_key_helper is a function that use agent config to check the keyssubstitude_env_vars
: replace env vars with values, does not dump configpassword
: the password to encrypt/decrypt the private key.
Returns:
the agent configuration manager.
get_
overridables
Get config overridables.