ShopBot/config.py

27 lines
746 B
Python
Raw Permalink Normal View History

2022-06-04 22:02:51 +03:00
from environs import Env
CONFIG_FILE = '.env'
env = Env()
env.read_env(CONFIG_FILE)
2022-06-16 00:32:17 +03:00
token: str = env.str("TOKEN")
service_chat: int = env.int("SERVICE_CHAT")
db_url: str = env.str("DATABASE_URL", "sqlite:///database.sqlite3")
permission_file: str = env.str("PERMISSION_FILE", "permission.json")
2022-06-04 22:02:51 +03:00
2022-06-16 00:32:17 +03:00
use_webhook: bool = env.bool("USE_WEBHOOK", False)
skip_updates: bool = env.bool("SKIP_UPDATE", True)
telegram_api_server: str = env.str("TELEGRAM_API_SERVER", "https://api.telegram.org")
2022-06-04 22:02:51 +03:00
if use_webhook:
2022-06-16 00:32:17 +03:00
webhook_app_host: str = env.str("APP_HOST")
webhook_app_port: int = env.int("APP_PORT")
2022-06-04 22:02:51 +03:00
2022-06-16 00:32:17 +03:00
webhook_host: str = env.str("WEBHOOK_HOST")
2022-06-04 22:02:51 +03:00
2022-06-16 00:32:17 +03:00
webhook_path: str = f"/bot{token}"
webhook_url: str = f"{webhook_host}{webhook_path}"