2023-08-09 13:11:14 +03:30
|
|
|
from decouple import config
|
2022-11-25 03:38:42 +03:30
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
|
|
load_dotenv()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SQLALCHEMY_DATABASE_URL = config("SQLALCHEMY_DATABASE_URL", default="sqlite:///db.sqlite3")
|
2024-08-05 22:46:02 +03:30
|
|
|
SQLALCHEMY_POOL_SIZE = config("SQLALCHEMY_POOL_SIZE", cast=int, default=10)
|
|
|
|
|
SQLIALCHEMY_MAX_OVERFLOW = config("SQLIALCHEMY_MAX_OVERFLOW", cast=int, default=30)
|
2022-11-25 03:38:42 +03:30
|
|
|
|
2023-01-21 17:04:23 +03:30
|
|
|
UVICORN_HOST = config("UVICORN_HOST", default="0.0.0.0")
|
2022-11-25 03:38:42 +03:30
|
|
|
UVICORN_PORT = config("UVICORN_PORT", cast=int, default=8000)
|
2023-01-05 14:52:46 +03:30
|
|
|
UVICORN_UDS = config("UVICORN_UDS", default=None)
|
|
|
|
|
UVICORN_SSL_CERTFILE = config("UVICORN_SSL_CERTFILE", default=None)
|
|
|
|
|
UVICORN_SSL_KEYFILE = config("UVICORN_SSL_KEYFILE", default=None)
|
2024-10-15 15:17:36 +03:00
|
|
|
UVICORN_SSL_CA_TYPE = config("UVICORN_SSL_CA_TYPE", default="public").lower()
|
2024-10-12 09:48:34 +00:00
|
|
|
DASHBOARD_PATH = config("DASHBOARD_PATH", default="/dashboard/")
|
2022-11-25 03:38:42 +03:30
|
|
|
|
2022-12-20 00:34:43 +03:30
|
|
|
DEBUG = config("DEBUG", default=False, cast=bool)
|
2023-01-21 17:04:23 +03:30
|
|
|
DOCS = config("DOCS", default=False, cast=bool)
|
2022-12-20 00:34:43 +03:30
|
|
|
|
2024-09-04 11:49:49 +03:30
|
|
|
ALLOWED_ORIGINS = config("ALLOWED_ORIGINS", default="*").split(",")
|
2024-07-31 11:52:39 +01:00
|
|
|
|
2023-05-06 11:46:19 +08:00
|
|
|
VITE_BASE_API = f"http://127.0.0.1:{UVICORN_PORT}/api/" \
|
|
|
|
|
if DEBUG and config("VITE_BASE_API", default="/api/") == "/api/" \
|
|
|
|
|
else config("VITE_BASE_API", default="/api/")
|
2022-12-20 00:34:43 +03:30
|
|
|
|
2023-05-21 15:14:19 +03:30
|
|
|
XRAY_JSON = config("XRAY_JSON", default="./xray_config.json")
|
2023-03-13 02:14:54 +03:30
|
|
|
XRAY_FALLBACKS_INBOUND_TAG = config("XRAY_FALLBACKS_INBOUND_TAG", cast=str, default="") or config(
|
|
|
|
|
"XRAY_FALLBACK_INBOUND_TAG", cast=str, default=""
|
|
|
|
|
)
|
2022-11-25 03:38:42 +03:30
|
|
|
XRAY_EXECUTABLE_PATH = config("XRAY_EXECUTABLE_PATH", default="/usr/local/bin/xray")
|
|
|
|
|
XRAY_ASSETS_PATH = config("XRAY_ASSETS_PATH", default="/usr/local/share/xray")
|
2023-01-09 19:31:48 +03:30
|
|
|
XRAY_EXCLUDE_INBOUND_TAGS = config("XRAY_EXCLUDE_INBOUND_TAGS", default='').split()
|
2023-01-09 21:29:23 +03:30
|
|
|
XRAY_SUBSCRIPTION_URL_PREFIX = config("XRAY_SUBSCRIPTION_URL_PREFIX", default="").strip("/")
|
2023-12-28 16:35:47 +03:30
|
|
|
XRAY_SUBSCRIPTION_PATH = config("XRAY_SUBSCRIPTION_PATH", default="sub").strip("/")
|
2022-11-25 03:38:42 +03:30
|
|
|
|
2023-08-07 17:17:16 +03:30
|
|
|
TELEGRAM_API_TOKEN = config("TELEGRAM_API_TOKEN", default="")
|
2023-08-19 12:04:36 +03:30
|
|
|
TELEGRAM_ADMIN_ID = config(
|
|
|
|
|
'TELEGRAM_ADMIN_ID',
|
|
|
|
|
default="",
|
|
|
|
|
cast=lambda v: [int(i) for i in filter(str.isdigit, (s.strip() for s in v.split(',')))]
|
|
|
|
|
)
|
2023-08-07 17:17:16 +03:30
|
|
|
TELEGRAM_PROXY_URL = config("TELEGRAM_PROXY_URL", default="")
|
|
|
|
|
TELEGRAM_LOGGER_CHANNEL_ID = config("TELEGRAM_LOGGER_CHANNEL_ID", cast=int, default=0)
|
|
|
|
|
TELEGRAM_DEFAULT_VLESS_FLOW = config("TELEGRAM_DEFAULT_VLESS_FLOW", default="")
|
2023-01-25 18:23:28 +03:30
|
|
|
|
2022-11-25 03:38:42 +03:30
|
|
|
JWT_ACCESS_TOKEN_EXPIRE_MINUTES = config("JWT_ACCESS_TOKEN_EXPIRE_MINUTES", cast=int, default=1440)
|
|
|
|
|
|
2023-04-05 16:12:16 +00:00
|
|
|
CUSTOM_TEMPLATES_DIRECTORY = config("CUSTOM_TEMPLATES_DIRECTORY", default=None)
|
2023-05-24 15:26:26 +03:30
|
|
|
SUBSCRIPTION_PAGE_TEMPLATE = config("SUBSCRIPTION_PAGE_TEMPLATE", default="subscription/index.html")
|
|
|
|
|
HOME_PAGE_TEMPLATE = config("HOME_PAGE_TEMPLATE", default="home/index.html")
|
2024-07-22 17:32:00 +03:30
|
|
|
|
|
|
|
|
CLASH_SUBSCRIPTION_TEMPLATE = config("CLASH_SUBSCRIPTION_TEMPLATE", default="clash/default.yml")
|
2024-07-23 21:32:10 +03:30
|
|
|
CLASH_SETTINGS_TEMPLATE = config("CLASH_SETTINGS_TEMPLATE", default="clash/settings.yml")
|
2024-07-22 17:32:00 +03:30
|
|
|
|
2023-09-13 23:15:35 +03:30
|
|
|
SINGBOX_SUBSCRIPTION_TEMPLATE = config("SINGBOX_SUBSCRIPTION_TEMPLATE", default="singbox/default.json")
|
2024-07-22 17:32:00 +03:30
|
|
|
SINGBOX_SETTINGS_TEMPLATE = config("SINGBOX_SETTINGS_TEMPLATE", default="singbox/settings.json")
|
|
|
|
|
|
2024-02-19 22:57:48 +03:30
|
|
|
MUX_TEMPLATE = config("MUX_TEMPLATE", default="mux/default.json")
|
2024-07-22 17:32:00 +03:30
|
|
|
|
2024-02-19 22:57:48 +03:30
|
|
|
V2RAY_SUBSCRIPTION_TEMPLATE = config("V2RAY_SUBSCRIPTION_TEMPLATE", default="v2ray/default.json")
|
2024-07-22 17:32:00 +03:30
|
|
|
V2RAY_SETTINGS_TEMPLATE = config("V2RAY_SETTINGS_TEMPLATE", default="v2ray/settings.json")
|
|
|
|
|
|
2024-07-01 17:56:41 +03:30
|
|
|
USER_AGENT_TEMPLATE = config("USER_AGENT_TEMPLATE", default="user_agent/default.json")
|
2024-07-04 13:42:14 +03:30
|
|
|
GRPC_USER_AGENT_TEMPLATE = config("GRPC_USER_AGENT_TEMPLATE", default="user_agent/grpc.json")
|
2024-07-01 17:56:41 +03:30
|
|
|
|
2024-07-31 13:16:45 +03:30
|
|
|
EXTERNAL_CONFIG = config("EXTERNAL_CONFIG", default="", cast=str)
|
2024-10-18 14:36:27 +03:30
|
|
|
LOGIN_NOTIFY_WHITE_LIST = [ip.strip() for ip in config("LOGIN_NOTIFY_WHITE_LIST",
|
|
|
|
|
default="", cast=str).split(",") if ip.strip()]
|
2023-09-13 23:15:35 +03:30
|
|
|
|
2024-05-19 12:25:43 +03:30
|
|
|
USE_CUSTOM_JSON_DEFAULT = config("USE_CUSTOM_JSON_DEFAULT", default=False, cast=bool)
|
2024-04-04 02:34:12 +01:00
|
|
|
USE_CUSTOM_JSON_FOR_V2RAYN = config("USE_CUSTOM_JSON_FOR_V2RAYN", default=False, cast=bool)
|
2024-05-19 12:25:43 +03:30
|
|
|
USE_CUSTOM_JSON_FOR_V2RAYNG = config("USE_CUSTOM_JSON_FOR_V2RAYNG", default=False, cast=bool)
|
2024-06-28 01:41:12 +03:30
|
|
|
USE_CUSTOM_JSON_FOR_STREISAND = config("USE_CUSTOM_JSON_FOR_STREISAND", default=False, cast=bool)
|
2024-12-29 23:08:47 +05:00
|
|
|
USE_CUSTOM_JSON_FOR_HAPP = config("USE_CUSTOM_JSON_FOR_HAPP", default=False, cast=bool)
|
2023-09-13 23:15:35 +03:30
|
|
|
|
2024-07-21 00:52:51 +03:30
|
|
|
NOTIFY_STATUS_CHANGE = config("NOTIFY_STATUS_CHANGE", default=True, cast=bool)
|
|
|
|
|
NOTIFY_USER_CREATED = config("NOTIFY_USER_CREATED", default=True, cast=bool)
|
|
|
|
|
NOTIFY_USER_UPDATED = config("NOTIFY_USER_UPDATED", default=True, cast=bool)
|
|
|
|
|
NOTIFY_USER_DELETED = config("NOTIFY_USER_DELETED", default=True, cast=bool)
|
|
|
|
|
NOTIFY_USER_DATA_USED_RESET = config("NOTIFY_USER_DATA_USED_RESET", default=True, cast=bool)
|
|
|
|
|
NOTIFY_USER_SUB_REVOKED = config("NOTIFY_USER_SUB_REVOKED", default=True, cast=bool)
|
2024-08-04 13:38:46 +03:30
|
|
|
NOTIFY_IF_DATA_USAGE_PERCENT_REACHED = config("NOTIFY_IF_DATA_USAGE_PERCENT_REACHED", default=True, cast=bool)
|
2024-10-18 14:36:27 +03:30
|
|
|
NOTIFY_IF_DAYS_LEFT_REACHED = config("NOTIFY_IF_DAYS_LEFT_REACHED", default=True, cast=bool)
|
2024-07-21 00:52:51 +03:30
|
|
|
NOTIFY_LOGIN = config("NOTIFY_LOGIN", default=True, cast=bool)
|
|
|
|
|
|
2024-04-01 14:12:11 +01:00
|
|
|
ACTIVE_STATUS_TEXT = config("ACTIVE_STATUS_TEXT", default="Active")
|
|
|
|
|
EXPIRED_STATUS_TEXT = config("EXPIRED_STATUS_TEXT", default="Expired")
|
|
|
|
|
LIMITED_STATUS_TEXT = config("LIMITED_STATUS_TEXT", default="Limited")
|
|
|
|
|
DISABLED_STATUS_TEXT = config("DISABLED_STATUS_TEXT", default="Disabled")
|
|
|
|
|
ONHOLD_STATUS_TEXT = config("ONHOLD_STATUS_TEXT", default="On-Hold")
|
|
|
|
|
|
2024-05-03 21:54:40 +03:30
|
|
|
USERS_AUTODELETE_DAYS = config("USERS_AUTODELETE_DAYS", default=-1, cast=int)
|
|
|
|
|
USER_AUTODELETE_INCLUDE_LIMITED_ACCOUNTS = config("USER_AUTODELETE_INCLUDE_LIMITED_ACCOUNTS", default=False, cast=bool)
|
2024-07-19 09:55:33 +03:30
|
|
|
|
2022-11-25 03:38:42 +03:30
|
|
|
|
|
|
|
|
# USERNAME: PASSWORD
|
2023-05-01 12:29:39 +03:30
|
|
|
SUDOERS = {config("SUDO_USERNAME"): config("SUDO_PASSWORD")} \
|
|
|
|
|
if config("SUDO_USERNAME", default='') and config("SUDO_PASSWORD", default='') \
|
|
|
|
|
else {}
|
2023-04-03 14:45:57 +03:30
|
|
|
|
|
|
|
|
|
2024-02-03 21:01:04 +03:30
|
|
|
WEBHOOK_ADDRESS = config(
|
|
|
|
|
'WEBHOOK_ADDRESS',
|
|
|
|
|
default="",
|
2024-02-11 17:50:06 +03:30
|
|
|
cast=lambda v: [address.strip() for address in v.split(',')] if v else []
|
2024-02-03 21:01:04 +03:30
|
|
|
)
|
2023-04-03 14:45:57 +03:30
|
|
|
WEBHOOK_SECRET = config("WEBHOOK_SECRET", default=None)
|
2023-06-24 20:22:26 +03:30
|
|
|
|
2023-08-21 00:47:33 +03:30
|
|
|
# recurrent notifications
|
|
|
|
|
|
|
|
|
|
# timeout between each retry of sending a notification in seconds
|
|
|
|
|
RECURRENT_NOTIFICATIONS_TIMEOUT = config("RECURRENT_NOTIFICATIONS_TIMEOUT", default=180, cast=int)
|
|
|
|
|
# how many times to try after ok response not recevied after sending a notifications
|
|
|
|
|
NUMBER_OF_RECURRENT_NOTIFICATIONS = config("NUMBER_OF_RECURRENT_NOTIFICATIONS", default=3, cast=int)
|
|
|
|
|
|
|
|
|
|
# sends a notification when the user uses this much of thier data
|
2024-10-18 14:36:27 +03:30
|
|
|
NOTIFY_REACHED_USAGE_PERCENT = config(
|
|
|
|
|
"NOTIFY_REACHED_USAGE_PERCENT",
|
2024-10-21 16:06:08 +03:30
|
|
|
default="80",
|
2024-10-18 14:36:27 +03:30
|
|
|
cast=lambda v: [int(p.strip()) for p in v.split(',')] if v else []
|
|
|
|
|
)
|
2023-08-21 00:47:33 +03:30
|
|
|
|
|
|
|
|
# sends a notification when there is n days left of their service
|
2024-10-18 14:36:27 +03:30
|
|
|
NOTIFY_DAYS_LEFT = config(
|
|
|
|
|
"NOTIFY_DAYS_LEFT",
|
2024-10-21 16:06:08 +03:30
|
|
|
default="3",
|
2024-10-18 14:36:27 +03:30
|
|
|
cast=lambda v: [int(d.strip()) for d in v.split(',')] if v else []
|
|
|
|
|
)
|
2023-08-21 00:47:33 +03:30
|
|
|
|
2023-08-19 12:04:36 +03:30
|
|
|
DISABLE_RECORDING_NODE_USAGE = config("DISABLE_RECORDING_NODE_USAGE", cast=bool, default=False)
|
2023-09-06 00:21:11 +03:00
|
|
|
|
|
|
|
|
# headers: profile-update-interval, support-url, profile-title
|
|
|
|
|
SUB_UPDATE_INTERVAL = config("SUB_UPDATE_INTERVAL", default="12")
|
|
|
|
|
SUB_SUPPORT_URL = config("SUB_SUPPORT_URL", default="https://t.me/")
|
2023-10-15 23:55:00 +03:30
|
|
|
SUB_PROFILE_TITLE = config("SUB_PROFILE_TITLE", default="Subscription")
|
|
|
|
|
|
|
|
|
|
# discord webhook log
|
2024-02-11 17:50:06 +03:30
|
|
|
DISCORD_WEBHOOK_URL = config("DISCORD_WEBHOOK_URL", default="")
|
2024-08-05 23:01:15 +03:30
|
|
|
|
|
|
|
|
|
|
|
|
|
# Interval jobs, all values are in seconds
|
|
|
|
|
JOB_CORE_HEALTH_CHECK_INTERVAL = config("JOB_CORE_HEALTH_CHECK_INTERVAL", cast=int, default=10)
|
|
|
|
|
JOB_RECORD_NODE_USAGES_INTERVAL = config("JOB_RECORD_NODE_USAGES_INTERVAL", cast=int, default=30)
|
|
|
|
|
JOB_RECORD_USER_USAGES_INTERVAL = config("JOB_RECORD_USER_USAGES_INTERVAL", cast=int, default=10)
|
|
|
|
|
JOB_REVIEW_USERS_INTERVAL = config("JOB_REVIEW_USERS_INTERVAL", cast=int, default=10)
|
|
|
|
|
JOB_SEND_NOTIFICATIONS_INTERVAL = config("JOB_SEND_NOTIFICATIONS_INTERVAL", cast=int, default=30)
|