feat: implement admin services management, Docker deployment, and YooKassa webhook IP security checks
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import os
|
||||
|
||||
# Load environment variables from .env in the project root
|
||||
def _load_env():
|
||||
root_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
dotenv_path = os.path.join(root_dir, ".env")
|
||||
if os.path.exists(dotenv_path):
|
||||
try:
|
||||
with open(dotenv_path, "r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#"):
|
||||
continue
|
||||
if "=" in line:
|
||||
key, val = line.split("=", 1)
|
||||
val = val.strip().strip('"').strip("'")
|
||||
os.environ[key.strip()] = val
|
||||
except Exception as e:
|
||||
print(f"Warning: Failed to load .env file: {e}")
|
||||
|
||||
_load_env()
|
||||
|
||||
# VK API Configuration
|
||||
VK_TOKEN = os.getenv("VK_TOKEN", "your_vk_community_token_here")
|
||||
GROUP_ID = int(os.getenv("VK_GROUP_ID", "0"))
|
||||
|
||||
# Operator / Admin configuration
|
||||
OPERATOR_PEER_ID = int(os.getenv("OPERATOR_PEER_ID", "0"))
|
||||
|
||||
admin_ids_raw = os.getenv("ADMIN_IDS")
|
||||
if admin_ids_raw:
|
||||
try:
|
||||
ADMIN_IDS = [int(x.strip()) for x in admin_ids_raw.split(",") if x.strip().isdigit()]
|
||||
except Exception:
|
||||
ADMIN_IDS = [OPERATOR_PEER_ID] if OPERATOR_PEER_ID else []
|
||||
else:
|
||||
ADMIN_IDS = [OPERATOR_PEER_ID] if OPERATOR_PEER_ID else []
|
||||
|
||||
# YooKassa Configuration
|
||||
YOOKASSA_SHOP_ID = os.getenv("YOOKASSA_SHOP_ID", "")
|
||||
YOOKASSA_SECRET_KEY = os.getenv("YOOKASSA_SECRET_KEY", "")
|
||||
|
||||
# SMTP configuration for email notifications
|
||||
SMTP_SERVER = os.getenv("SMTP_SERVER", "smtp.yandex.ru")
|
||||
SMTP_PORT = int(os.getenv("SMTP_PORT", "465"))
|
||||
SMTP_USER = os.getenv("SMTP_USER", "")
|
||||
SMTP_PASSWORD = os.getenv("SMTP_PASSWORD", "")
|
||||
SMTP_FROM = os.getenv("SMTP_FROM", "")
|
||||
SMTP_TO = os.getenv("SMTP_TO", "")
|
||||
|
||||
# Admin Dashboard Password
|
||||
ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD", "admin123")
|
||||
|
||||
# Supplier / Agent Configuration for 54-FZ receipts (Agent Scheme)
|
||||
SUPPLIER_NAME = os.getenv("SUPPLIER_NAME", "ИП Груздев Артём Сергеевич")
|
||||
SUPPLIER_INN = os.getenv("SUPPLIER_INN", "370306440114")
|
||||
SUPPLIER_PHONE = os.getenv("SUPPLIER_PHONE", "+79611157051")
|
||||
TAX_SYSTEM_CODE = int(os.getenv("TAX_SYSTEM_CODE", "2")) # Default: 2 (УСН Доход ООО "АЙТИГРУПП")
|
||||
|
||||
# Security Configurations
|
||||
VERIFY_WEBHOOK_IP = os.getenv("VERIFY_WEBHOOK_IP", "True").lower() == "true"
|
||||
|
||||
Reference in New Issue
Block a user