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]:
|
def _get_proxies() -> dict[str, str]:
|
||||||
"""Get git proxies from config."""
|
"""Get git proxies from config.
|
||||||
proxies = {}
|
|
||||||
|
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():
|
for key, value in config.get_all().items():
|
||||||
if key.startswith("proxy_"):
|
if key.startswith("proxy_") and isinstance(value, str) and value:
|
||||||
name = key[6:] # Remove 'proxy_' prefix
|
proxies[key[6:]] = value
|
||||||
proxies[name] = value
|
|
||||||
return proxies
|
return proxies
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user