fix(git): prefer connections.proxy over legacy flat keys
Keep git proxy lookup aligned with layered config, with proxy_* fallback.
This commit is contained in:
@@ -11,12 +11,22 @@ from mytoolkit.config import config
|
||||
|
||||
|
||||
def _get_proxies() -> dict[str, str]:
|
||||
"""Get git proxies from config."""
|
||||
proxies = {}
|
||||
"""Get git proxies from config.
|
||||
|
||||
Prefers hierarchical ``connections.proxy.<name>``; falls back to legacy
|
||||
flat ``proxy_<name>`` keys for older configs.
|
||||
"""
|
||||
proxies: dict[str, str] = {}
|
||||
nested = config.get("connections.proxy")
|
||||
if isinstance(nested, dict):
|
||||
for name, value in nested.items():
|
||||
if isinstance(value, str) and value:
|
||||
proxies[str(name)] = value
|
||||
if proxies:
|
||||
return proxies
|
||||
for key, value in config.get_all().items():
|
||||
if key.startswith("proxy_"):
|
||||
name = key[6:] # Remove 'proxy_' prefix
|
||||
proxies[name] = value
|
||||
if key.startswith("proxy_") and isinstance(value, str) and value:
|
||||
proxies[key[6:]] = value
|
||||
return proxies
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user