Skip to content

Commit

Permalink
Change default values for bool env variables to true
Browse files Browse the repository at this point in the history
  • Loading branch information
captaincolonelfox committed Apr 7, 2024
1 parent 70b5d9a commit 8f1b3b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)

0 comments on commit 8f1b3b6

Please sign in to comment.