mirror of
https://gitlab.com/octospacc/TelegramIndex-Fork.git
synced 2025-06-05 22:09:12 +02:00
initial commit
This commit is contained in:
33
app/config.py
Normal file
33
app/config.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
try:
|
||||
port = int(os.environ.get("PORT", "8080"))
|
||||
except ValueError:
|
||||
port = -1
|
||||
if not 1 <= port <= 65535:
|
||||
print("Please make sure the PORT environment variable is an integer between 1 and 65535")
|
||||
sys.exit(1)
|
||||
|
||||
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")
|
||||
print("You can get your own API keys at https://my.telegram.org/apps")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
chat_id = int(os.environ["CHAT_ID"])
|
||||
except (KeyError, ValueError):
|
||||
print("Please 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")
|
||||
sys.exit(1)
|
||||
|
||||
host = os.environ.get("HOST", "0.0.0.0")
|
Reference in New Issue
Block a user