feat: switch config to JSONC + split secrets.json

Load business config as JSONC (comments + trailing commas) via an
in-repo stripper then stdlib json — no new deps. Default path prefers
config.jsonc, falls back to legacy config.json. Auth write-back targets
only sibling secrets.json so JSONC comments are never wiped; secrets
overlay merges on load. Examples, compose, Docker, docs, favsort and
tools all share the same loader. Phase A only — no DB settings migration.
This commit was merged in pull request #4.
This commit is contained in:
bot-ci committed 2026-11-02 12:58:20 +08:00
1 parent b4f0f45c4e
commit 8e7ead1669
21 files changed
+652 -182

No files matched your search

+4 -4
View File
@@ -28,7 +28,7 @@ from .bilibili.auth_flow import AuthService
from .bilibili.client import BilibiliClient, Pacer
from .bilibili.provider import ClientProvider
from .bilibili.search import SearchClient
from .config import ConfigError, ConfigStore
from .config import ConfigError, ConfigStore, default_config_path
from .database import Database
from .logging_json import JsonLogger
from .notify.telegram import TelegramClient
@@ -42,7 +42,7 @@ from .services.up_profile import UpProfileService
from .timeutil import next_daily_run, parse_hhmm, shanghai_date
ROOT = Path(__file__).resolve().parent.parent
DEFAULT_CONFIG = ROOT / "config.json"
DEFAULT_CONFIG = default_config_path(ROOT)
def _build_parser() -> argparse.ArgumentParser:
@@ -50,7 +50,7 @@ def _build_parser() -> argparse.ArgumentParser:
common.add_argument(
"--config",
default=argparse.SUPPRESS,
help="配置文件路径(默认项目根目录 config.json)",
help="配置文件路径(默认优先 config.jsonc,否则 config.json)",
)
parser = argparse.ArgumentParser(
@@ -60,7 +60,7 @@ def _build_parser() -> argparse.ArgumentParser:
parser.add_argument(
"--config",
default=str(DEFAULT_CONFIG),
help="配置文件路径(默认项目根目录 config.json)",
help="配置文件路径(默认优先 config.jsonc,否则 config.json)",
)
sub = parser.add_subparsers(dest="command", required=False)