feat(config): 支持从host_config.yaml加载配置
当host_config.yaml存在时优先使用该文件,否则回退到keyring.yaml
This commit is contained in:
parent
a7ea6307e7
commit
71e3f14788
@ -3,10 +3,12 @@ from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
_CONFIG_PATH = Path(__file__).parent / "keyring.yaml"
|
||||
_HOST_CONFIG_PATH = Path(__file__).parent / "host_config.yaml"
|
||||
|
||||
|
||||
def _load() -> dict[str, Any]:
|
||||
with open(_CONFIG_PATH, "r", encoding="utf-8") as f:
|
||||
config_path = _HOST_CONFIG_PATH if _HOST_CONFIG_PATH.exists() else _CONFIG_PATH
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
return yaml.safe_load(f) or {}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user