Skip to content

Commit

Permalink
Update config.py to check for the presence of environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Nunnito committed Jul 16, 2024
1 parent baee402 commit 2bbbe9a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ def get_config(self) -> dict:

with open(config_dir/"bot.json", "w") as f:
json.dump(self.bot, f, indent=4, ensure_ascii=False)
exit(1)

if not os.getenv("API_ID") or not os.getenv("API_HASH"):
logger.error("API_ID and API_HASH environment variables not " +
" found please add them to your environment " +
"variables.")
logger.error("Exiting...")
exit(1)

with open(config_dir/"bot.json", "r") as f:
return json.load(f)
Expand Down

0 comments on commit 2bbbe9a

Please sign in to comment.