You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
"""
|
|
配置管理
|
|
"""
|
|
import os
|
|
from typing import Optional
|
|
|
|
class Config:
|
|
"""配置类"""
|
|
|
|
# 数据库配置
|
|
DATABASE_URL: str = os.getenv("DATABASE_URL", "sqlite:///./code_scanner.db")
|
|
|
|
# AI服务配置
|
|
DEEPSEEK_API_URL: str = os.getenv("DEEPSEEK_API_URL", "https://api.deepseek.com/v1/chat/completions")
|
|
DEEPSEEK_API_KEY: str = os.getenv("DEEPSEEK_API_KEY", "your_deepseek_api_key_here")
|
|
|
|
# 文件上传配置
|
|
UPLOAD_FOLDER: str = os.getenv("UPLOAD_FOLDER", "uploads")
|
|
MAX_CONTENT_LENGTH: int = int(os.getenv("MAX_CONTENT_LENGTH", "16 * 1024 * 1024")) # 16MB
|
|
|
|
# 扫描配置
|
|
MAX_SCAN_FILES: int = int(os.getenv("MAX_SCAN_FILES", "1000"))
|
|
SCAN_TIMEOUT: int = int(os.getenv("SCAN_TIMEOUT", "300")) # 5分钟
|
|
|
|
# 报告配置
|
|
REPORTS_FOLDER: str = os.getenv("REPORTS_FOLDER", "reports")
|
|
|
|
# 日志配置
|
|
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
|
|
LOG_FILE: str = os.getenv("LOG_FILE", "app.log")
|
|
|
|
# 创建配置实例
|
|
config = Config()
|