Explicitly use proxy

This commit is contained in:
Nexus 2024-02-24 15:16:27 +00:00
parent 390488558e
commit 94e12af103
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -52,6 +52,9 @@ app = fastapi.FastAPI(
root_path=os.environ.get("PREVIEW_ROOT_PATH", ""),
lifespan=startup
)
proxy = os.getenv("PREVIEW_PROXY")
if proxy:
logging.debug("Using proxy: %r", proxy)
lock = Lock()
# noinspection PyTypeChecker
app.add_middleware(
@ -259,7 +262,8 @@ def preview_url(
},
timeout=60,
follow_redirects=False,
trust_env=True # for HTTP[S]/ALL_PROXY environment variables.
trust_env=True, # for HTTP[S]/ALL_PROXY environment variables.
proxy=proxy
) as client:
try:
response = client.get(