Support the http_proxy environment variable

Overrides General.proxy setting if set
This commit is contained in:
miruka
2021-03-02 12:32:48 -04:00
parent f6f0a0c1ee
commit 6febaeeb1b
4 changed files with 10 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import asyncio
import html
import io
import logging as log
import os
import platform
import re
import textwrap
@@ -167,7 +168,8 @@ class MatrixClient(nio.AsyncClient):
store = Path(backend.appdirs.user_data_dir) / "encryption"
store.mkdir(parents=True, exist_ok=True)
proxy = backend.settings.General.proxy
proxy: Optional[str]
proxy = os.environ.get("http_proxy", backend.settings.General.proxy)
host = re.sub(r":\d+$", "", urlparse(homeserver).netloc)
if host in ("127.0.0.1", "localhost", "::1"):