MCPcopy
hub / github.com/su-kaka/gcli2api / get_config_value

Function get_config_value

config.py:97–112  ·  view source on GitHub ↗

Get configuration value with priority: ENV > Storage > default.

(key: str, default: Any = None, env_var: Optional[str] = None)

Source from the content-addressed store, hash-verified

95
96
97async 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

Callers 15

get_callback_portFunction · 0.90
get_proxy_configFunction · 0.85
get_auto_ban_enabledFunction · 0.85
get_auto_ban_error_codesFunction · 0.85
get_retry_429_enabledFunction · 0.85
get_retry_429_intervalFunction · 0.85
get_server_hostFunction · 0.85
get_server_portFunction · 0.85
get_api_passwordFunction · 0.85
get_panel_passwordFunction · 0.85

Calls 2

init_configFunction · 0.85
_get_cached_configFunction · 0.85

Tested by

no test coverage detected