From 3f40e083ce7687f0592d85bee4c632e52fd475ff Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Tue, 21 Feb 2023 16:46:43 -0500 Subject: [PATCH] add mucha config to coreconfig --- core/config.py | 1 + core/mucha.py | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/core/config.py b/core/config.py index f8f57e4..04ad280 100644 --- a/core/config.py +++ b/core/config.py @@ -194,6 +194,7 @@ class CoreConfig(dict): self.allnet = AllnetConfig(self) self.billing = BillingConfig(self) self.aimedb = AimedbConfig(self) + self.mucha = MuchaConfig(self) @classmethod def str_to_loglevel(cls, level_str: str): diff --git a/core/mucha.py b/core/mucha.py index 312d83f..0848c70 100644 --- a/core/mucha.py +++ b/core/mucha.py @@ -35,9 +35,14 @@ class MuchaServlet: return b"" req = MuchaAuthRequest(req_dict) - self.logger.info(f"Mucha request {vars(req)}") - resp = MuchaAuthResponse(mucha_url=f"{self.config.mucha.hostname}:{self.config.mucha.port}") - self.logger.info(f"Mucha response {vars(resp)}") + self.logger.debug(f"Mucha request {vars(req)}") + + if self.config.server.is_develop: + resp = MuchaAuthResponse(mucha_url=f"{self.config.mucha.hostname}:{self.config.mucha.port}") + else: + resp = MuchaAuthResponse(mucha_url=f"{self.config.mucha.hostname}") + + self.logger.debug(f"Mucha response {vars(resp)}") return self.mucha_postprocess(vars(resp)) @@ -48,9 +53,14 @@ class MuchaServlet: return b"" req = MuchaUpdateRequest(req_dict) - self.logger.info(f"Mucha request {vars(req)}") - resp = MuchaUpdateResponse(mucha_url=f"{self.config.mucha.hostname}:{self.config.mucha.port}") - self.logger.info(f"Mucha response {vars(resp)}") + self.logger.debug(f"Mucha request {vars(req)}") + + if self.config.server.is_develop: + resp = MuchaUpdateResponse(mucha_url=f"{self.config.mucha.hostname}:{self.config.mucha.port}") + else: + resp = MuchaUpdateResponse(mucha_url=f"{self.config.mucha.hostname}") + + self.logger.debug(f"Mucha response {vars(resp)}") return self.mucha_postprocess(vars(resp))