55
66from data_agent import __version__
77from data_agent .api import ServiceApi
8- from data_agent .config_manager import (
9- PersistentComponent ,
10- component_config_view ,
11- init_configuration ,
12- )
13- from data_agent .config_template import (
14- CONFIG_SECTION_BROKER ,
15- CONFIG_SECTION_CONNECTION_MANAGER ,
16- CONFIG_SECTION_DAQ_SCHEDULER ,
17- CONFIG_SECTION_LOG ,
18- CONFIG_SECTION_SAFE_MANIPULATOR ,
19- CONFIG_SECTION_SERVICE ,
20- )
8+ from data_agent .config_manager import ConfigManager
219from data_agent .connection_manager import ConnectionManager
2210from data_agent .daq_scheduler import create_daq_scheduler
2311from data_agent .exchanger import DataExchanger
@@ -35,10 +23,10 @@ class BrokerAgent:
3523 _scheduler = None
3624
3725 async def init (self , loop , is_service = False , enable_persistance = True ):
38- self ._config , _ = init_configuration ( is_service , loop )
39- service_config = component_config_view ( self . _config , CONFIG_SECTION_SERVICE )
40- broker_config = component_config_view ( self ._config , CONFIG_SECTION_BROKER )
41- log_config = component_config_view ( self ._config , CONFIG_SECTION_LOG )
26+ self ._config = ConfigManager ( loop = loop , enable_persistance = enable_persistance )
27+
28+ service_config = self ._config . get ( "service" )
29+ broker_config = self ._config . get ( "broker" )
4230
4331 uri_pattern = re .compile (r"(\b(?:[a-z]{,5})://.*:)(.*)(@[^ \b]+)" , re .MULTILINE )
4432 broker_uri_wo_pass = re .sub (uri_pattern , r"\1**********\3" , broker_config .uri )
@@ -50,8 +38,10 @@ async def init(self, loop, is_service=False, enable_persistance=True):
5038 f" FQN: { service_config .domain } .{ service_config .type } .{ service_config .id } "
5139 )
5240 log .info (f" Broker URI: { broker_uri_wo_pass } " )
53- log .info (f" Config directory: { self ._config .config_dir ()} " )
54- log .info (f' Logs path: { log_config ["handlers" ]["file" ]["filename" ]} ' )
41+ log .info (f" Config directory: { self ._config .base_path } " )
42+ log .info (
43+ f" Logs path: { self ._config .get ('log.handlers.file.filename' )} "
44+ )
5545 log .info (
5646 "***********************************************************************"
5747 )
@@ -70,29 +60,15 @@ async def init(self, loop, is_service=False, enable_persistance=True):
7060 if handler .get_name () == "amqp" :
7161 await self ._broker_conn .init_logging_handler (handler )
7262
73- self ._connection_manager = ConnectionManager (
74- PersistentComponent (
75- self ._config ,
76- CONFIG_SECTION_CONNECTION_MANAGER ,
77- enable_persistence = enable_persistance ,
78- )
79- )
63+ self ._connection_manager = ConnectionManager (config = self ._config )
8064 self ._safe_manipulator = SafeManipulator (
81- self ._connection_manager ,
82- PersistentComponent (
83- self ._config ,
84- CONFIG_SECTION_SAFE_MANIPULATOR ,
85- enable_persistence = enable_persistance ,
86- ),
65+ connection_manager = self ._connection_manager ,
66+ config = self ._config ,
8767 )
8868 self ._scheduler = create_daq_scheduler (
89- self ._broker_conn ,
90- self ._connection_manager ,
91- PersistentComponent (
92- self ._config ,
93- CONFIG_SECTION_DAQ_SCHEDULER ,
94- enable_persistence = enable_persistance ,
95- ),
69+ broker = self ._broker_conn ,
70+ conn_manager = self ._connection_manager ,
71+ config = self ._config ,
9672 )
9773 self ._data_exchanger = DataExchanger (self ._connection_manager )
9874 api = ServiceApi (
0 commit comments