Page MenuHomePhabricator

Wire http proxy environment vars to scraper web adapter
Closed, ResolvedPublic

Description

The scraper http client adapter was changed since our last run, and the newer adapter requires the HTTP_PROXY and HTTPS_PROXY variables to be manually wired into the adapter proxy options. This is necessary on the analytics clients where outbound traffic must go through a proxy, see /etc/profile.d/proxy.sh.

Options should be in the form given in https://hexdocs.pm/mint/Mint.HTTP.html#connect/4-proxying

Hardcoding the options would look like this:

Wiki.Enterprise.new(username: username(), refresh_token: refresh_token(), connect_options: [proxy: {:http, "webproxy", 8080, []}])

However, the mediawiki-client library should pull proxy configuration from HTTP_PROXY, HTTPS_PROXY, http_proxy, and https_proxy environment variables as a best practice, using System.get_env/1 and falling back through the possible set- or unset-ness.

Code for review:
See also these references and discussions:

Event Timeline

awight updated the task description. (Show Details)

Just came across a surprise: although subdomains are notated with a dot like .wmnet in the Wikimedia proxy howto, the actual values on the server look like wmnet so we need to adjust the code to accomodate both formats.