TelegramIndex-Fork/run-dev.py

32 lines
906 B
Python
Raw Normal View History

2021-06-06 13:31:26 +02:00
import os
from dotenv import load_dotenv
load_dotenv() # take environment variables from .env.
# Code of your application, which uses environment variables (e.g. from `os.environ` or
# `os.getenv`) as if they came from the actual environment.
# os.system("alias python3=python")
def runSetup():
def alert(missing):
2021-07-05 18:31:39 +02:00
print(f"\nCopy your {missing} and save it as an environment variable.\n")
req_env_vars = ["API_ID", "API_HASH", "INDEX_SETTINGS"]
2021-06-06 13:31:26 +02:00
for env_var in req_env_vars:
env_value = os.getenv(env_var)
if env_value is None:
alert(env_var)
return
if os.getenv("SESSION_STRRING") is None:
os.system("python app/generate_session_string.py")
2021-07-05 18:31:39 +02:00
print("\nCopy your SESSION_STRING from above and save it as an environment variable.")
return
2021-06-06 13:31:26 +02:00
os.system("python -m app")
2021-06-06 13:31:26 +02:00
if __name__ == "__main__":
runSetup()