From d3af7332aaba36c61e538a5ee5619b7d87024d30 Mon Sep 17 00:00:00 2001 From: TheTechromancer Date: Wed, 20 Dec 2023 08:04:51 -0500 Subject: [PATCH 1/2] insert comment notice in yaml configs --- bbot/core/configurator/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bbot/core/configurator/__init__.py b/bbot/core/configurator/__init__.py index 9e3a7d010..6bf93d75d 100644 --- a/bbot/core/configurator/__init__.py +++ b/bbot/core/configurator/__init__.py @@ -66,6 +66,9 @@ def ensure_config_files(): secrets_strings = ["api_key", "username", "password", "token", "secret", "_id"] exclude_keys = ["modules", "output_modules", "internal_modules"] + comment_notice = "# NOTICE: THESE ENTRIES ARE COMMENTED BY DEFAULT\n" + \ + "# Please be sure to uncomment when inserting API keys, etc.\n" + # ensure bbot.yml if not files.config_filename.exists(): log_to_stderr(f"Creating BBOT config at {files.config_filename}") @@ -77,7 +80,7 @@ def ensure_config_files(): exclude_keys=exclude_keys, ) yaml = OmegaConf.to_yaml(no_secrets_config) - yaml = "\n".join(f"# {line}" for line in yaml.splitlines()) + yaml = comment_notice + "\n".join(f"# {line}" for line in yaml.splitlines()) with open(str(files.config_filename), "w") as f: f.write(yaml) @@ -92,7 +95,7 @@ def ensure_config_files(): exclude_keys=exclude_keys, ) yaml = OmegaConf.to_yaml(secrets_only_config) - yaml = "\n".join(f"# {line}" for line in yaml.splitlines()) + yaml = comment_notice + "\n".join(f"# {line}" for line in yaml.splitlines()) with open(str(files.secrets_filename), "w") as f: f.write(yaml) files.secrets_filename.chmod(0o600) From 07a43fe252f8742d6aa2e1256c8bb4a4680b9eae Mon Sep 17 00:00:00 2001 From: TheTechromancer Date: Wed, 20 Dec 2023 08:08:36 -0500 Subject: [PATCH 2/2] blacked --- bbot/core/configurator/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bbot/core/configurator/__init__.py b/bbot/core/configurator/__init__.py index 6bf93d75d..15962ce59 100644 --- a/bbot/core/configurator/__init__.py +++ b/bbot/core/configurator/__init__.py @@ -66,8 +66,10 @@ def ensure_config_files(): secrets_strings = ["api_key", "username", "password", "token", "secret", "_id"] exclude_keys = ["modules", "output_modules", "internal_modules"] - comment_notice = "# NOTICE: THESE ENTRIES ARE COMMENTED BY DEFAULT\n" + \ - "# Please be sure to uncomment when inserting API keys, etc.\n" + comment_notice = ( + "# NOTICE: THESE ENTRIES ARE COMMENTED BY DEFAULT\n" + + "# Please be sure to uncomment when inserting API keys, etc.\n" + ) # ensure bbot.yml if not files.config_filename.exists():