From dc445bcc66cd59d3753bc9da2ba2867f9ff80c0e Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sun, 17 Aug 2025 15:36:07 +0100 Subject: [PATCH] Ignore invalid environment variables --- smsbot/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smsbot/cli.py b/smsbot/cli.py index 76e0d3a..771d074 100644 --- a/smsbot/cli.py +++ b/smsbot/cli.py @@ -49,7 +49,11 @@ def main(): # Override with environment variables, named SMSBOT_
_ for key, value in os.environ.items(): if key.startswith(ENVIRONMENT_PREFIX): - section, option = key[7:].lower().split("_", 1) + try: + section, option = key[7:].lower().split("_", 1) + except ValueError: + logging.debug("Invalid environment variable format: %s", key) + continue logging.debug("Overriding config %s/%s = %s", section, option, value) if not config.has_section(section): config.add_section(section)