2021-06-21 14:05:07 +02:00
|
|
|
import os
|
|
|
|
|
|
|
|
# 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")
|
|
|
|
|
2021-07-17 06:35:14 +02:00
|
|
|
|
2021-06-21 14:05:07 +02:00
|
|
|
def runSetup():
|
2021-07-04 13:01:01 +02:00
|
|
|
def alert(missing):
|
2021-06-21 14:05:07 +02:00
|
|
|
print(
|
2021-07-04 13:01:01 +02:00
|
|
|
f"\nCopy your {missing} and save it into Secrets (Environment variables) Sidebar!\n"
|
2021-06-21 14:05:07 +02:00
|
|
|
)
|
|
|
|
|
2021-06-26 23:02:06 +02:00
|
|
|
req_env_vars = ["API_ID", "API_HASH", "INDEX_SETTINGS"]
|
2021-07-04 13:01:01 +02:00
|
|
|
|
2021-06-26 23:02:06 +02:00
|
|
|
for env_var in req_env_vars:
|
2021-07-04 13:01:01 +02:00
|
|
|
env_value = os.getenv(env_var)
|
2021-06-26 23:02:06 +02:00
|
|
|
if env_value is None:
|
2021-07-04 13:01:01 +02:00
|
|
|
alert(env_var)
|
|
|
|
return
|
2021-07-17 06:35:14 +02:00
|
|
|
|
2021-07-04 13:01:01 +02:00
|
|
|
if os.getenv("SESSION_STRING") is None:
|
2021-06-21 14:05:07 +02:00
|
|
|
os.system("python app/generate_session_string.py")
|
2021-07-17 06:35:14 +02:00
|
|
|
print(
|
|
|
|
"\nCopy your SESSION_STRING from above and save it into Secrets (Environment variables) Sidebar!"
|
|
|
|
)
|
2021-06-21 14:05:07 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
os.system("python -m app")
|
|
|
|
|
2021-07-17 06:35:14 +02:00
|
|
|
|
2021-06-21 14:05:07 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
runSetup()
|