refactor: move credentials to .env and add python-dotenv support

Replace hardcoded database credentials, ntfy tokens, and Uptime Kuma
push URLs with environment variable lookups via python-dotenv.
Add .env.example template and update .gitignore to exclude .env.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-06-12 12:27:45 +08:00
parent bc461c12ce
commit 8639fedf74
6 changed files with 35 additions and 11 deletions

View File

@@ -19,9 +19,9 @@ LOG_TABLE_CONFIG = {
# 从原 config.py 抽取
NTFY_CONFIG = {
'enabled': True,
'server_url': 'https://ntfy.server10086.icu',
'topic': 'bld',
'token': 'tk_eop5fs66acxtwxf6vlkiojhdvkgb0',
'server_url': os.environ.get('NTFY_SERVER_URL', ''),
'topic': os.environ.get('NTFY_TOPIC', ''),
'token': os.environ.get('NTFY_TOKEN', ''),
'priority': {
'error': 'high',
'critical': 'urgent'
@@ -32,14 +32,14 @@ NTFY_CONFIG = {
# 增量同步服务心跳
UPTIME_KUMA_CONFIG = {
'enabled': True,
'push_url': 'https://uptimekuma.server10086.icu/api/push/clMSgOQs4CJeF7DJAOiHaFaaZzoL8eB9',
'push_url': os.environ.get('UPTIME_KUMA_PUSH_URL', ''),
'heartbeat_interval': 59 # 心跳间隔(秒),需要与 Uptime Kuma 设置一致
}
# Excel 同步服务心跳
EXCEL_SYNC_UPTIME_KUMA_CONFIG = {
'enabled': True,
'push_url': 'https://uptimekuma.server10086.icu/api/push/MEXi5DYnC3nTMs2OfMqdelK3FawymtVY',
'push_url': os.environ.get('EXCEL_SYNC_UPTIME_KUMA_PUSH_URL', ''),
'heartbeat_interval': 59 # 心跳间隔(秒),需要与 Uptime Kuma 设置一致
}