feat: confs2 C++20 重写替代 Python confs,时间戳改系统时区

- 新增 confs2/:C++20 重写统一配置服务(libmsg RpcServer)
  - main.cpp: ConfigStore + 4 路由(get/list/reload/health) + INI/JSON 按键取值
  - LogC.hpp: 异步日志客户端(含 P2-3 日志注入防护)
  - 安全机制:TOCTOU 防护、路径遍历防护、扩展名白名单、1MiB 大小限制、缓存防污染
  - 21/21 对比测试全部通过,性能 3x(0.33ms vs 1.01ms),RSS -66%
- confs/confs.py + log_client.py: 时间戳从 timezone.utc 改为系统时区
- confs2/src/main.cpp + LogC.hpp: 同步改为系统时区(localtime + %z)
- core/init.txt: confs/_run.sh → confs2/_run.sh
This commit is contained in:
qing committed 2026-08-09 14:18:57 +00:00
1 parent c13d11aafb
commit 1b282c6f1a
10 files changed
+917 -7

No files matched your search

+3 -3
View File
@@ -29,7 +29,7 @@ import os
import sys
import threading
import time
from datetime import datetime, timezone
from datetime import datetime
# pymsg / log_client 导入:生产环境 pymsg 由 venv(pip install ../pymsg)提供;
# 附加 ../pymsg 源码路径作为无 venv 时的开发兜底
@@ -67,8 +67,8 @@ class KeyNotFound(ConfigError):
def _iso(ts: float) -> str:
"""时间戳转 ISO 8601(UTC,与 db 服务的日期序列化约定一致)。"""
return datetime.fromtimestamp(ts, tz=timezone.utc).isoformat()
"""时间戳转 ISO 8601(系统时区)。"""
return datetime.fromtimestamp(ts).astimezone().isoformat()
# ═══════════════════════════════════════════════════════════════════════