File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 2020 "conf.bus.bindtoeventexchange" : True ,
2121}
2222
23+ DOT_MARKER = os .getenv ("SERVC_DOT_MARKER" , "_DOT_" )
24+
2325
2426class Config :
2527 _configDictionary : dict = {}
@@ -59,7 +61,7 @@ def __init__(self, config_path: str | None = None):
5961 raise Exception ("Configuration file does not match the configuration path" )
6062
6163 def get (self , key : str ) -> Any :
62- keys = [x .replace ("--" , "." ) for x in key . lower () .split ("." )]
64+ keys = [x .replace (DOT_MARKER , "." ) for x in key .split ("." )]
6365 subconfig = self ._configDictionary
6466
6567 for index , subkey in enumerate (keys ):
@@ -71,7 +73,7 @@ def get(self, key: str) -> Any:
7173 subconfig = subconfig .get (subkey , {})
7274
7375 def setValue (self , key : str , value : Any ):
74- keys = [x .replace ("--" , "." ) for x in key . lower () .split ("." )]
76+ keys = [x .replace (DOT_MARKER , "." ) for x in key .split ("." )]
7577 subconfig = self ._configDictionary
7678
7779 for index , subkey in enumerate (keys ):
Original file line number Diff line number Diff line change @@ -18,13 +18,11 @@ def test_value(self):
1818 self .assertEqual (self .config .get ("conf.bus.prefix" ), "test" )
1919
2020 self .config .setValue ("conf.bus.routemap.api" , "test_route" )
21- self .assertEqual (self .config .get (
22- "conf.bus.routemap.api" ), "test_route" )
21+ self .assertEqual (self .config .get ("conf.bus.routemap.api" ), "test_route" )
2322
24- self .config .setValue ("conf.bus.routemap--api" , "test_route" )
25- self .assertEqual (self .config .get (
26- "conf.bus.routemap--api" ), "test_route" )
27- self .assertIn ("routemap.api" , self .config .get ('conf.bus' ))
23+ self .config .setValue ("conf.bus.routemap_DOT_api" , "test_route" )
24+ self .assertEqual (self .config .get ("conf.bus.routemap_DOT_api" ), "test_route" )
25+ self .assertIn ("routemap.api" , self .config .get ("conf.bus" ))
2826
2927 def test_wrong_location (self ):
3028 try :
You can’t perform that action at this time.
0 commit comments