DeepHat-DeepHat-V1-7B-Chat / core /config_loader.py
S-Dreamer's picture
Rename config_loader.py to core/config_loader.py
9e683ac verified
raw
history blame contribute delete
563 Bytes
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Configuration loader with sane defaults and fallback behavior."""
import os
import yaml
from typing import Any, Dict
def load_config(path: str = "config.yaml") -> Dict[str, Any]:
if not os.path.exists(path):
print(f"⚠️ Config file missing at {path}, using defaults.")
return {
"app": {"name": "MyApp", "debug": True},
"server": {"host": "0.0.0.0", "port": 8000},
}
with open(path, "r", encoding="utf-8") as f:
return yaml.safe_load(f) or {}