Files
exchange_monitor_sync/config/settings.py
2025-12-02 22:05:54 +08:00

35 lines
1.2 KiB
Python

import os
from dotenv import load_dotenv
load_dotenv()
# Redis配置
REDIS_CONFIG = {
'host': os.getenv('REDIS_HOST', 'localhost'),
'port': int(os.getenv('REDIS_PORT', 6379)),
'password': os.getenv('REDIS_PASSWORD', ''),
'db': int(os.getenv('REDIS_DB', 0)),
'decode_responses': True,
'max_connections': 30
}
# 同步配置
SYNC_CONFIG = {
'interval': int(os.getenv('SYNC_INTERVAL', 60)), # 同步间隔(秒)
'recent_days': int(os.getenv('RECENT_DAYS', 3)), # 同步最近几天数据
'chunk_size': int(os.getenv('CHUNK_SIZE', 1000)), # 批量处理大小
'enable_position_sync': os.getenv('ENABLE_POSITION_SYNC', 'true').lower() == 'true',
'enable_order_sync': os.getenv('ENABLE_ORDER_SYNC', 'true').lower() == 'true',
'enable_account_sync': os.getenv('ENABLE_ACCOUNT_SYNC', 'true').lower() == 'true'
}
# 日志配置
LOG_CONFIG = {
'level': os.getenv('LOG_LEVEL', 'INFO'),
'rotation': os.getenv('LOG_ROTATION', '10 MB'),
'retention': os.getenv('LOG_RETENTION', '7 days'),
'format': '{time:YYYY-MM-DD HH:mm:ss} | {level} | {name}:{function}:{line} - {message}'
}
# 计算机名配置(用于过滤账号)
COMPUTER_NAME = os.getenv('COMPUTER_NAME', 'lz_c01')