diff --git a/CHANGELOG.md b/CHANGELOG.md index b8df7cef..c0012079 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project closely adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.181.0 +- Change - only obfuscate values in config yaml file + ## 0.180.0 - Change - only obfuscate certain parts in json output diff --git a/pyproject.toml b/pyproject.toml index 0ad3422a..ce8221a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cucu" -version = "0.180.0" +version = "0.181.0" license = "MIT" description = "Easy BDD web testing" authors = ["Domino Data Lab "] diff --git a/src/cucu/config.py b/src/cucu/config.py index 191484e8..4c54f1e2 100644 --- a/src/cucu/config.py +++ b/src/cucu/config.py @@ -304,27 +304,15 @@ def to_yaml_without_secrets(self): ] config = {k: self[k] for k in sorted(keys)} - results = self.hide_secrets(yaml.dump(config)) - # fix leading '*' issue - is_bytes = isinstance(results, bytes) - if is_bytes: - results = results.decode() - - lines = results.split("\n") - for x in range(len(lines)): - parts = lines[x].split(": ", 1) - if len(parts) != 2: - continue - - key, value = parts[0], parts[1] - if value.startswith("*"): - lines[x] = f"{key}: '{value}'" - results = "\n".join(lines) - - if is_bytes: - results = results.encode() + for k, v in config.items(): + if isinstance(v, str): + v = self.hide_secrets(v) + # fix leading '*' issue + if v.startswith("*"): + v = f"'{v}'" + config[k] = v - return results + return yaml.dump(config) # global config object @@ -348,7 +336,7 @@ def _get_local_address(): CONFIG.define( "CWD", "the current working directory of the cucu process", - default=os.getcwd, + default=os.getcwd(), ) CONFIG.define( "CUCU_SECRETS",