Refactor configuration management and remove deprecated files

- Consolidated database, file source, and field mapping configurations into dedicated modules under the `config` directory.
- Removed hardcoded database connection details from `migration.py` and replaced them with imports from the new configuration structure.
- Updated `ntfy_utils.py` and `run_incremental_sync.py` to utilize the new configuration imports for cleaner code and better maintainability.
- Deleted `update_config.py` as its contents have been integrated into the new configuration files.
- Added a new `settings.local.json` for managing permissions related to script execution.
- Enhanced the structure of the migration tasks and Excel configurations for better organization and clarity.
This commit is contained in:
Misaka_Company
2026-01-12 12:49:51 +08:00
parent ee14de0435
commit 83c90f0161
13 changed files with 501 additions and 365 deletions

View File

@@ -1,12 +1,12 @@
# ntfy_utils.py
import requests
import config
from config import NTFY_CONFIG
def send_ntfy(message, title="数据库同步消息", priority="default", tags=None):
"""
向加密的 ntfy 服务器发送消息
"""
conf = config.NTFY_CONFIG
conf = NTFY_CONFIG
if not conf.get('enabled', False):
return
@@ -51,7 +51,7 @@ def send_error(msg):
send_ntfy(
message=str(msg),
title="❌ 同步任务错误",
priority=config.NTFY_CONFIG['priority']['error'],
priority=NTFY_CONFIG['priority']['error'],
tags=["warning", "database"]
)
@@ -60,6 +60,6 @@ def send_critical(msg):
send_ntfy(
message=str(msg),
title="🔥 同步服务崩溃",
priority=config.NTFY_CONFIG['priority']['critical'],
priority=NTFY_CONFIG['priority']['critical'],
tags=["skull", "critical"]
)