Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTP Proxy support to NPM Binary Installer #1067

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion installers/npm/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ const run = () => {

const install = () => {
const binary = getBinary();
binary.install();

const proxy = configureProxy()

binary.install(proxy);

let pluginInstallCommand = `${binary.binaryPath} install --plugin`;
let commands = [
`${pluginInstallCommand} supergraph@latest-0`,
Expand All @@ -136,6 +140,30 @@ const install = () => {
}
};

const configureProxy = () => {
// get proxy env
const env = process.env.HTTP_PROXY || process.env.HTTPS_PROXY
farawaysouthwest marked this conversation as resolved.
Show resolved Hide resolved

// short circuit if null
if (!env) return null

// parse
const {host, port, protocol, username, password} = new URL(env)

// return proxy object for axios request
return {
proxy: {
protocol,
host,
port,
auth: {
username,
password
}
},
};
}

module.exports = {
install,
run,
Expand Down