refactor: centralize configuration management with type-safe schema
Major changes: - Add dataclass-based configuration schema with validation (config/schema.py) - Create centralized config loader and default values (config/defaults.py, config/loader.py) - Remove duplicate database_config.py, merge into unified structure - Consolidate browser settings into ERP config - Add batch_size parameter support to extractor Bug fixes: - Fix settings save error by updating config paths (browser.* → erp.*) - Fix batch_size not being applied in data extraction Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,17 @@ project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
if project_root not in sys.path:
|
||||
sys.path.insert(0, project_root)
|
||||
|
||||
from config.database_config import SQL_SERVER_CONFIG
|
||||
from config.defaults import DEFAULT_APP_CONFIG
|
||||
|
||||
# 从默认配置获取数据库配置
|
||||
SQL_SERVER_CONFIG = {
|
||||
'driver': DEFAULT_APP_CONFIG.database.driver,
|
||||
'server': DEFAULT_APP_CONFIG.database.server,
|
||||
'database': DEFAULT_APP_CONFIG.database.database,
|
||||
'username': DEFAULT_APP_CONFIG.database.username,
|
||||
'password': DEFAULT_APP_CONFIG.database.password,
|
||||
'TrustServerCertificate': DEFAULT_APP_CONFIG.database.trust_server_certificate,
|
||||
}
|
||||
|
||||
|
||||
class DatabaseConnection:
|
||||
|
||||
Reference in New Issue
Block a user