gitscope
https://dev.kronoz.win/r/marzneshin.git
config.py · v0.1.4
Source
1 a47eb4c Dawsh 2y ago import os
2 a47eb4c Dawsh 2y ago from decouple import config
3 a47eb4c Dawsh 2y ago from dotenv import load_dotenv
4 a47eb4c Dawsh 2y ago
5 a47eb4c Dawsh 2y ago load_dotenv()
6 a47eb4c Dawsh 2y ago
7 a47eb4c Dawsh 2y ago
8 a47eb4c Dawsh 2y ago SQLALCHEMY_DATABASE_URL = config("SQLALCHEMY_DATABASE_URL", default="sqlite:///db.sqlite3")
9 a47eb4c Dawsh 2y ago
10 a47eb4c Dawsh 2y ago
11 a47eb4c Dawsh 2y ago UVICORN_HOST = config("UVICORN_HOST", default="0.0.0.0")
12 a47eb4c Dawsh 2y ago UVICORN_PORT = config("UVICORN_PORT", cast=int, default=8000)
13 a47eb4c Dawsh 2y ago UVICORN_UDS = config("UVICORN_UDS", default=None)
14 a47eb4c Dawsh 2y ago UVICORN_SSL_CERTFILE = config("UVICORN_SSL_CERTFILE", default=None)
15 a47eb4c Dawsh 2y ago UVICORN_SSL_KEYFILE = config("UVICORN_SSL_KEYFILE", default=None)
16 a47eb4c Dawsh 2y ago
17 a47eb4c Dawsh 2y ago
18 a47eb4c Dawsh 2y ago DEBUG = config("DEBUG", default=False, cast=bool)
19 a47eb4c Dawsh 2y ago DOCS = config("DOCS", default=False, cast=bool)
20 a47eb4c Dawsh 2y ago
21 a47eb4c Dawsh 2y ago VITE_BASE_API = f"http://127.0.0.1:{UVICORN_PORT}/api/" \
22 a47eb4c Dawsh 2y ago if DEBUG and config("VITE_BASE_API", default="/api/") == "/api/" \
23 a47eb4c Dawsh 2y ago else config("VITE_BASE_API", default="/api/")
24 a47eb4c Dawsh 2y ago
25 a47eb4c Dawsh 2y ago XRAY_FALLBACKS_INBOUND_TAG = config("XRAY_FALLBACKS_INBOUND_TAG", cast=str, default="") or config(
26 a47eb4c Dawsh 2y ago "XRAY_FALLBACK_INBOUND_TAG", cast=str, default=""
27 a47eb4c Dawsh 2y ago )
28 a47eb4c Dawsh 2y ago XRAY_SUBSCRIPTION_URL_PREFIX = config("XRAY_SUBSCRIPTION_URL_PREFIX", default="").strip("/")
29 a47eb4c Dawsh 2y ago
30 a47eb4c Dawsh 2y ago TELEGRAM_API_TOKEN = config("TELEGRAM_API_TOKEN", default="")
31 a47eb4c Dawsh 2y ago TELEGRAM_ADMIN_ID = config(
32 a47eb4c Dawsh 2y ago 'TELEGRAM_ADMIN_ID',
33 a47eb4c Dawsh 2y ago default="",
34 a47eb4c Dawsh 2y ago cast=lambda v: [int(i) for i in filter(str.isdigit, (s.strip() for s in v.split(',')))]
35 a47eb4c Dawsh 2y ago )
36 a47eb4c Dawsh 2y ago TELEGRAM_PROXY_URL = config("TELEGRAM_PROXY_URL", default="")
37 a47eb4c Dawsh 2y ago TELEGRAM_LOGGER_CHANNEL_ID = config("TELEGRAM_LOGGER_CHANNEL_ID", cast=int, default=0)
38 a47eb4c Dawsh 2y ago TELEGRAM_DEFAULT_VLESS_FLOW = config("TELEGRAM_DEFAULT_VLESS_FLOW", default="")
39 a47eb4c Dawsh 2y ago
40 a47eb4c Dawsh 2y ago JWT_ACCESS_TOKEN_EXPIRE_MINUTES = config("JWT_ACCESS_TOKEN_EXPIRE_MINUTES", cast=int, default=1440)
41 a47eb4c Dawsh 2y ago
42 a47eb4c Dawsh 2y ago CUSTOM_TEMPLATES_DIRECTORY = config("CUSTOM_TEMPLATES_DIRECTORY", default=None)
43 a47eb4c Dawsh 2y ago CLASH_SUBSCRIPTION_TEMPLATE = config("CLASH_SUBSCRIPTION_TEMPLATE", default="clash/default.yml")
44 a47eb4c Dawsh 2y ago SUBSCRIPTION_PAGE_TEMPLATE = config("SUBSCRIPTION_PAGE_TEMPLATE", default="subscription/index.html")
45 a47eb4c Dawsh 2y ago HOME_PAGE_TEMPLATE = config("HOME_PAGE_TEMPLATE", default="home/index.html")
46 fcfb963 Mardin 2y ago
47 fcfb963 Mardin 2y ago SINGBOX_SUBSCRIPTION_TEMPLATE = config(
48 fcfb963 Mardin 2y ago "SINGBOX_SUBSCRIPTION_TEMPLATE",
49 fcfb963 Mardin 2y ago default="singbox/default.json"
50 fcfb963 Mardin 2y ago )
51 a47eb4c Dawsh 2y ago
52 a47eb4c Dawsh 2y ago
53 a47eb4c Dawsh 2y ago # USERNAME: PASSWORD
54 a47eb4c Dawsh 2y ago SUDOERS = {config("SUDO_USERNAME"): config("SUDO_PASSWORD")} \
55 a47eb4c Dawsh 2y ago if config("SUDO_USERNAME", default='') and config("SUDO_PASSWORD", default='') \
56 a47eb4c Dawsh 2y ago else {}
57 a47eb4c Dawsh 2y ago
58 a47eb4c Dawsh 2y ago
59 a47eb4c Dawsh 2y ago WEBHOOK_ADDRESS = config("WEBHOOK_ADDRESS", default=None)
60 a47eb4c Dawsh 2y ago WEBHOOK_SECRET = config("WEBHOOK_SECRET", default=None)
61 a47eb4c Dawsh 2y ago
62 a47eb4c Dawsh 2y ago # recurrent notifications
63 a47eb4c Dawsh 2y ago
64 a47eb4c Dawsh 2y ago # timeout between each retry of sending a notification in seconds
65 a47eb4c Dawsh 2y ago RECURRENT_NOTIFICATIONS_TIMEOUT = config("RECURRENT_NOTIFICATIONS_TIMEOUT", default=180, cast=int)
66 a47eb4c Dawsh 2y ago # how many times to try after ok response not recevied after sending a notifications
67 a47eb4c Dawsh 2y ago NUMBER_OF_RECURRENT_NOTIFICATIONS = config("NUMBER_OF_RECURRENT_NOTIFICATIONS", default=3, cast=int)
68 a47eb4c Dawsh 2y ago
69 a47eb4c Dawsh 2y ago # sends a notification when the user uses this much of thier data
70 a47eb4c Dawsh 2y ago NOTIFY_REACHED_USAGE_PERCENT = config("NOTIFY_REACHED_USAGE_PERCENT", default=80, cast=int)
71 a47eb4c Dawsh 2y ago
72 a47eb4c Dawsh 2y ago # sends a notification when there is n days left of their service
73 a47eb4c Dawsh 2y ago NOTIFY_DAYS_LEFT = config("NOTIFY_DAYS_LEFT", default=3, cast=int)
74 a47eb4c Dawsh 2y ago
75 a47eb4c Dawsh 2y ago DISABLE_RECORDING_NODE_USAGE = config("DISABLE_RECORDING_NODE_USAGE", cast=bool, default=False)
76 a47eb4c Dawsh 2y ago
77 a47eb4c Dawsh 2y ago # headers: profile-update-interval, support-url, profile-title
78 a47eb4c Dawsh 2y ago SUB_UPDATE_INTERVAL = config("SUB_UPDATE_INTERVAL", default="12")
79 a47eb4c Dawsh 2y ago SUB_SUPPORT_URL = config("SUB_SUPPORT_URL", default="https://t.me/")
80 6a606d6 Dawsh 2y ago SUB_PROFILE_TITLE = config("SUB_PROFILE_TITLE", default="Subscription")