From cfb24dd8854436682862152201229d32a9910919 Mon Sep 17 00:00:00 2001 From: Jordan Ruthe Date: Thu, 18 Feb 2021 12:48:27 -0500 Subject: [PATCH] config: redact moonraker api key while logging with new printers option --- ks_includes/config.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ks_includes/config.py b/ks_includes/config.py index 37686cd1..04a69615 100644 --- a/ks_includes/config.py +++ b/ks_includes/config.py @@ -83,7 +83,6 @@ class KlipperScreenConfig: raise ConfigError(f"Error reading config: {self.config_path}") printers = [i for i in self.config.sections() if i.startswith("printer ")] - logger.debug("Printers: %s %s" % (len(printers), printers)) self.printers = [] for printer in printers: self.printers.append({ @@ -102,7 +101,13 @@ class KlipperScreenConfig: } }) - logger.debug("Configured printers: %s" % json.dumps(self.printers, indent=2)) + conf_printers_debug = self.printers.copy() + for printer in conf_printers_debug: + name = list(printer)[0] + item = conf_printers_debug[conf_printers_debug.index(printer)] + if item[list(printer)[0]]['moonraker_api_key'] != "": + item[list(printer)[0]]['moonraker_api_key'] = "redacted" + logger.debug("Configured printers: %s" % json.dumps(conf_printers_debug, indent=2)) for item in self.configurable_options: name = list(item)[0]