Commit a05337dd authored by Marc-Andre Santune's avatar Marc-Andre Santune
Browse files

retrieve staging and registry from kwargs

parent 1cd590f6
......@@ -21,10 +21,15 @@ class BuildingGeneric:
"""Stores the methods used to receive or update the building info from ES doc"""
def __init__(self, uid: str, staging: str) -> None:
def __init__(self, uid: str, **kwargs) -> None:
staging = kwargs.get("staging", False)
registry = kwargs.get("registry")
self.logger = logging.getLogger(self.__class__.__name__)
self._uid = uid
self.settings = Settings(staging=staging)
self.settings = Settings(staging=staging, registry=registry)
self.fetch()
def __getitem__(self, item):
......
"""Store settings"""
from MaxIcsRegistry import MaxIcsRegistry
class Settings:
def __init__(self, staging: str, registry=None):
"""Settings"""
def __init__(self, staging: bool = False, registry=None) -> None:
if not registry:
registry = MaxIcsRegistry.from_env(staging=staging, skip_delay=True)
registry = MaxIcsRegistry.from_env(staging=staging)
building_center_info = registry.get_info("building-knowledge-information-center")
self.api_key = building_center_info["api_in"][registry.node_id]["key"]
self.base_url = "http://{}:{}/api/buildings/".format(
building_center_info["service_addr"], building_center_info["service_port"]
)
\ No newline at end of file
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment