Skip to content

Commit

Permalink
fix secrets default file name
Browse files Browse the repository at this point in the history
  • Loading branch information
nlef committed Mar 8, 2024
1 parent 8f4504b commit 6601fdf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bot/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6601fdf

Please sign in to comment.