Skip to content

Commit

Permalink
Merge pull request #428 from etemi/master
Browse files Browse the repository at this point in the history
Configure 'Got' to use HttpsProxyAgent for https URLs
  • Loading branch information
yoheimuta authored Aug 8, 2024
2 parents 5b01353 + 903a0c3 commit 6cc254e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bdist/js/install.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { got } from 'got';
import { createFetch } from 'got-fetch';
import npmlog from 'npmlog';
import { HttpProxyAgent } from 'http-proxy-agent';
import { HttpsProxyAgent } from 'https-proxy-agent';
import * as fs from 'fs';
import { temporaryFile } from 'tempy';
import * as tar from 'tar';
Expand All @@ -26,7 +27,8 @@ const arch = _arch_mapping[_arch] ?? _arch;

const url = `${protolint_host}/${protolint_path}/v${protolint_version}/${module_name}_${protolint_version}_${platform}_${arch}.tar.gz`;

let agent;
let httpAgent;
let httpsAgent;

let proxy_address;

Expand All @@ -39,11 +41,13 @@ if (!process.env.PROTOLINT_NO_PROXY) {
}

if (proxy_address) {
agent = new HttpProxyAgent(proxy_address);
httpAgent = new HttpProxyAgent(proxy_address);
httpsAgent = new HttpsProxyAgent(proxy_address);
}

const agent_config = {
http: agent
http: httpAgent,
https: httpsAgent
};

const got_config = {
Expand Down
14 changes: 14 additions & 0 deletions bdist/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bdist/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"got": "^12.0.0",
"got-fetch": "^5.1.6",
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.0",
"npmlog": "^7.0.1",
"semver": "^7.5.4",
"tar": "^6.2.0",
Expand Down

0 comments on commit 6cc254e

Please sign in to comment.