From 6601fdfee262e426c411c1b8bd308ea22d2b6c1c Mon Sep 17 00:00:00 2001 From: nlef <52351624+nlef@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:03:20 +0300 Subject: [PATCH] fix secrets default file name --- bot/configuration.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bot/configuration.py b/bot/configuration.py index 0e285a5..acc3d97 100644 --- a/bot/configuration.py +++ b/bot/configuration.py @@ -157,10 +157,14 @@ class SecretsConfig(ConfigHelper): def __init__(self, config: configparser.ConfigParser): secrets_path = Path(os.path.expanduser(config.get("secrets", "secrets_path", fallback=""))) + secrets_path_default_name = Path(os.path.expanduser(config.get("secrets", "secrets_path", fallback="") + "/secrets.conf")) + conf = configparser.ConfigParser(allow_no_value=True, inline_comment_prefixes=(";", "#")) if secrets_path and secrets_path.is_file(): - conf = configparser.ConfigParser(allow_no_value=True, inline_comment_prefixes=(";", "#")) conf.read(secrets_path.as_posix()) super().__init__(conf) + elif secrets_path_default_name and secrets_path_default_name.is_file(): + conf.read(secrets_path_default_name.as_posix()) + super().__init__(conf) else: self._section = "bot" super().__init__(config)