From 0085a117d6c9857f1d4fead6492b62eb78ec0e43 Mon Sep 17 00:00:00 2001 From: odysseusmax Date: Thu, 13 Aug 2020 04:05:46 +0000 Subject: [PATCH] print traceback for config errors --- app/config.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/config.py b/app/config.py index 87b3b37..3e2a6af 100644 --- a/app/config.py +++ b/app/config.py @@ -1,3 +1,4 @@ +import traceback import sys import os @@ -14,23 +15,26 @@ try: api_id = int(os.environ["API_ID"]) api_hash = os.environ["API_HASH"] except (KeyError, ValueError): - print("Please set the API_ID and API_HASH environment variables correctly") + traceback.print_exc() + print("\n\nPlease set the API_ID and API_HASH environment variables correctly") print("You can get your own API keys at https://my.telegram.org/apps") sys.exit(1) try: - chat_id_raw = os.environ["CHAT_ID"] - chat_ids = [int(chat_id) for chat_id in chat_id_raw.split(' ')] + chat_id_raw = os.environ["CHAT_ID"].strip() + chat_ids = [int(chat_id.strip()) for chat_id in chat_id_raw.split(' ')] alias_ids = [] except (KeyError, ValueError): - print("Please set the CHAT_ID environment variable correctly") + traceback.print_exc() + print("\n\nPlease set the CHAT_ID environment variable correctly") sys.exit(1) try: session_string = os.environ["SESSION_STRING"] except (KeyError, ValueError): - print("Please set the SESSION_STRING environment variable correctly") + traceback.print_exc() + print("\n\nPlease set the SESSION_STRING environment variable correctly") sys.exit(1) host = os.environ.get("HOST", "0.0.0.0") -debug = bool(os.environ.get("DEBUG")) +debug = True