refac: modularize backend IV
This commit is contained in:
parent
c88ba1e5a4
commit
3a9854c5db
8 changed files with 822 additions and 666 deletions
13
config.py
13
config.py
|
|
@ -124,3 +124,16 @@ def _config_path_from_env() -> Path:
|
|||
if candidate:
|
||||
return Path(candidate).expanduser()
|
||||
return Path("config.yaml")
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Shared config accessor
|
||||
# ------------------------------------------------------------------
|
||||
# Submodules read config at call time via get_config() instead of importing
|
||||
# a bound name. The single source of truth is ``router.config`` — the lazy
|
||||
# import below resolves it after router.py has finished loading, and lets
|
||||
# tests that ``patch.object(router, "config", cfg)`` flow through.
|
||||
def get_config() -> "Config":
|
||||
"""Return the currently active Config from router.py."""
|
||||
import router # lazy to avoid module-load circular import
|
||||
return router.config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue