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_NAMES = os.getenv('COMPUTER_NAMES', 'lz_c01') # 或者使用模式匹配 COMPUTER_NAME_PATTERN = os.getenv('COMPUTER_NAME_PATTERN', r'^lz_c\d{2}$')