refactor: move env var processing after IO initialization

This commit is contained in:
Paul Gauthier (aider) 2024-12-07 08:07:14 -08:00
parent 491d3e6606
commit b3305e6e19

View file

@ -472,6 +472,17 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
analytics = Analytics(permanently_disable=True)
print("Analytics have been permanently disabled.")
# Process any environment variables set via --set-env
if args.set_env:
for env_setting in args.set_env:
try:
name, value = env_setting.split('=', 1)
os.environ[name.strip()] = value.strip()
except ValueError:
io.tool_error(f"Invalid --set-env format: {env_setting}")
io.tool_output("Format should be: ENV_VAR_NAME=value")
return 1
if not args.verify_ssl:
import httpx