pip_services3_container.config package¶
Submodules¶
Module contents¶
pip_services3_container.config.__init__¶
Container configuration serves as a recipe for instantiating and configuring components inside the container.
External configurations (stored as YAML or JSON) are passed to the container and define the structure of objects that need to be recreated in the container. Objects can be defined in two ways:
using descriptors (using which registered factories can recreate the object)
using hard-coded types (objects are recreated directly, based on their type, bypassing factories).
In addition, various configurations are stored for each object. The container recreates the objects and, if they implement the IConfigurable interface, passes them their configurations.
- copyright
 Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
 MIT, see LICENSE for more details.
- 
class 
pip_services3_container.config.ComponentConfig(descriptor: pip_services3_commons.refer.Descriptor.Descriptor = None, type: pip_services3_commons.reflect.TypeDescriptor.TypeDescriptor = None, config: pip_services3_commons.config.ConfigParams.ConfigParams = None)¶ Bases:
objectConfiguration of a component inside a container.
The configuration includes type information or descriptor, and component configuration parameters.
- 
static 
from_config(config: pip_services3_commons.config.ConfigParams.ConfigParams) → pip_services3_container.config.ComponentConfig.ComponentConfig¶ Creates a new instance of ComponentConfig based on section from container configuration.
- Parameters
 config – component parameters from container configuration
- Returns
 a newly created ComponentConfig
- 
static 
 
- 
class 
pip_services3_container.config.ContainerConfig(components: Sequence[pip_services3_container.config.ComponentConfig.ComponentConfig] = None)¶ Bases:
listContainer configuration defined as a list of component configurations.
- 
static 
from_config(config: pip_services3_commons.config.ConfigParams.ConfigParams) → pip_services3_container.config.ContainerConfig.ContainerConfig¶ Creates a new
ContainerConfigobject based on configuration parameters. Each section in the configuration parameters is converted into a component configuration.- Parameters
 config – an object with key-value pairs used to initialize a new
ContainerConfig.- Returns
 a new
ContainerConfigobject.
- 
static 
from_value(value: Any) → pip_services3_container.config.ContainerConfig.ContainerConfig¶ Creates a new
ContainerConfigobject filled with key-value pairs from specified object. The value is converted intoConfigParamsobject which is used to create the object.- Parameters
 value – an object with key-value pairs used to initialize a new
ContainerConfig.- Returns
 a new
ContainerConfigobject.
- 
static 
 
- 
class 
pip_services3_container.config.ContainerConfigReader¶ Bases:
objectHelper class that reads container configuration from JSON or YAML file.
- 
static 
read_from_file(correlation_id: Optional[str], path: str, parameters: pip_services3_commons.config.ConfigParams.ConfigParams) → pip_services3_container.config.ContainerConfig.ContainerConfig¶ Reads container configuration from JSON or YAML file. The type of the file is determined by file extension.
- Parameters
 correlation_id – (optional) transaction id to trace execution through call chain.
path – a path to component configuration file.
parameters – values to parameters the configuration or null to skip parameterization.
- Returns
 the read container configuration
- 
static 
read_from_json_file(correlation_id: Optional[str], path: str, parameters: pip_services3_commons.config.ConfigParams.ConfigParams) → pip_services3_container.config.ContainerConfig.ContainerConfig¶ Reads container configuration from JSON file.
- Parameters
 correlation_id – (optional) transaction id to trace execution through call chain.
path – a path to component configuration file.
parameters – values to parameters the configuration or null to skip parameterization.
- Returns
 the read container configuration
- 
static 
read_from_yaml_file(correlation_id: Optional[str], path: str, parameters: pip_services3_commons.config.ConfigParams.ConfigParams) → pip_services3_container.config.ContainerConfig.ContainerConfig¶ Reads container configuration from YAML file.
- Parameters
 correlation_id – (optional) transaction id to trace execution through call chain.
path – a path to component configuration file.
parameters – values to parameters the configuration or null to skip parameterization.
- Returns
 the read container configuration
- 
static