Files
happy-life-star/tools/config.py
T
2025-12-25 18:04:10 +08:00

34 lines
902 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
配置文件
HTTP 接口测试工具的配置项
@author huazm
"""
import os
# 基础路径
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_DIR = os.path.join(BASE_DIR, 'data')
# 确保数据目录存在
os.makedirs(DATA_DIR, exist_ok=True)
class Config:
"""基础配置类"""
SECRET_KEY = os.environ.get('SECRET_KEY') or 'api-tester-secret-key-2024'
SQLALCHEMY_DATABASE_URI = f'sqlite:///{os.path.join(DATA_DIR, "api_tester.db")}'
SQLALCHEMY_TRACK_MODIFICATIONS = False
# HTTP 客户端配置
REQUEST_TIMEOUT = 30 # 请求超时时间(秒)
MAX_RESPONSE_SIZE = 10 * 1024 * 1024 # 最大响应大小(10MB
# 历史记录配置
MAX_HISTORY_RECORDS = 1000 # 最大历史记录数
# 批量请求配置
MAX_BATCH_SIZE = 100 # 最大批量请求数
DEFAULT_BATCH_INTERVAL = 100 # 默认请求间隔(毫秒)