Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions servc/svc/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, config_path: str | None = None):
raise Exception("Configuration file does not match the configuration path")

def get(self, key: str) -> Any:
keys = key.lower().split(".")
keys = [x.replace("--", ".") for x in key.lower().split(".")]
subconfig = self._configDictionary

for index, subkey in enumerate(keys):
Expand All @@ -71,7 +71,7 @@ def get(self, key: str) -> Any:
subconfig = subconfig.get(subkey, {})

def setValue(self, key: str, value: Any):
keys = key.lower().split(".")
keys = [x.replace("--", ".") for x in key.lower().split(".")]
subconfig = self._configDictionary

for index, subkey in enumerate(keys):
Expand Down
8 changes: 7 additions & 1 deletion tests/svc/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ def test_value(self):
self.assertEqual(self.config.get("conf.bus.prefix"), "test")

self.config.setValue("conf.bus.routemap.api", "test_route")
self.assertEqual(self.config.get("conf.bus.routemap.api"), "test_route")
self.assertEqual(self.config.get(
"conf.bus.routemap.api"), "test_route")

self.config.setValue("conf.bus.routemap--api", "test_route")
self.assertEqual(self.config.get(
"conf.bus.routemap--api"), "test_route")
self.assertIn("routemap.api", self.config.get('conf.bus'))

def test_wrong_location(self):
try:
Expand Down
Loading