From 8f1b3b610dbf633757781aa06186294d9b45abd0 Mon Sep 17 00:00:00 2001 From: Igor Popov Date: Sun, 7 Apr 2024 12:59:11 +0300 Subject: [PATCH] Change default values for bool env variables to true --- app/settings.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/settings.py b/app/settings.py index 5718f67..4ed2cb7 100644 --- a/app/settings.py +++ b/app/settings.py @@ -15,13 +15,13 @@ def parse_env_list(key: str) -> list[int]: return json.loads(os.getenv(key, "[]")) -def parse_env_bool(key: str) -> bool: - return os.getenv(key, "false").lower() in ("yes", "true", "1", "on") +def parse_env_bool(key: str, default: str = "false") -> bool: + return os.getenv(key, default).lower() in ("yes", "true", "1", "on") settings = Settings( api_token=os.getenv("API_TOKEN", ""), allowed_ids=parse_env_list("ALLOWED_IDS"), - reply_to_message=parse_env_bool("REPLY_TO_MESSAGE"), - with_captions=parse_env_bool("WITH_CAPTIONS"), + reply_to_message=parse_env_bool("REPLY_TO_MESSAGE", default="true"), + with_captions=parse_env_bool("WITH_CAPTIONS", default="true"), )