Get configuration value with priority: ENV > Storage > default.
(key: str, default: Any = None, env_var: Optional[str] = None)
| 95 | |
| 96 | |
| 97 | async def get_config_value(key: str, default: Any = None, env_var: Optional[str] = None) -> Any: |
| 98 | """Get configuration value with priority: ENV > Storage > default.""" |
| 99 | # 确保配置已初始化 |
| 100 | if not _config_initialized: |
| 101 | await init_config() |
| 102 | |
| 103 | # Priority 1: Environment variable |
| 104 | if env_var and os.getenv(env_var): |
| 105 | return os.getenv(env_var) |
| 106 | |
| 107 | # Priority 2: Memory cache |
| 108 | value = _get_cached_config(key) |
| 109 | if value is not None: |
| 110 | return value |
| 111 | |
| 112 | return default |
| 113 | |
| 114 | |
| 115 | # Configuration getters - all async |
no test coverage detected