refactor: keep runtime settings below adapters

This commit is contained in:
jxxghp
2026-08-23 01:45:07 +08:00
parent d15c65b108
commit 2c6e8181c2
8 changed files with 47 additions and 39 deletions
+2 -7
View File
@@ -1,9 +1,8 @@
import json
import importlib
from typing import Any, Dict, Tuple, Optional
from app.application.configuration import get_runtime_settings
from app.runtime.log import logger
from app.runtime.settings import get_runtime_setting
from app.foundation.crypto import CryptoJsUtils, HashUtils
from app.adapters.network.http import RequestUtils
from app.domain import site as site_rules
@@ -13,11 +12,7 @@ from app.foundation.url import UrlUtils
def _runtime_setting(key: str) -> Any:
"""读取 CookieCloud 配置服务,未装配时回退旧 Settings ABI。"""
try:
return get_runtime_settings().get(key)
except RuntimeError:
legacy_settings = importlib.import_module("app.runtime.config").settings
return getattr(legacy_settings, key)
return get_runtime_setting(key)
class CookieCloudHelper: