Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Comments

Apply Chromium proxies to env vars for apm#898

Merged
damieng merged 1 commit intomasterfrom
dg-apply-proxy-to-apm
Jan 19, 2017
Merged

Apply Chromium proxies to env vars for apm#898
damieng merged 1 commit intomasterfrom
dg-apply-proxy-to-apm

Conversation

@damieng
Copy link
Contributor

@damieng damieng commented Jan 12, 2017

Description of the Change

Chromium does a good job at reading system proxy settings which means a lot of what Atom needs to do goes through the correct proxies.

The apm command line being a regular node app and not an Electron/Chromium app does not read or have access to these proxy settings and so fails when trying to connect if you are using a proxy.

This change determines what http and https proxy servers to use based on Chromium's session.resolveProxy call with atom.io and then sets the http_proxy and https_proxy environment variables that apm then uses.

Alternate Designs

Alternative designs include;

  1. Moving apm functionality entirely into Atom - too much work at this time and would mess up command-line scripting
  2. Editing the apm.rc file with the proxy settings - too destructive

Benefits

People behind proxy servers can use apm with no effort.

Possible Drawbacks

Users with manually set http_proxy and https_proxy environment variables will find we override their preferences. They can switch off the auto-detect proxy in settings.

schema? and (schema.type isnt 'any')

setProxyServers: (callback) =>
callback() if atom.config.get('core.useProxySettingsWhenCallingApm') isnt true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callback() unless atom.config.get('core.useProxySettingsWhenCallingApm')

seems cleaner.

@winstliu
Copy link
Contributor

Also, this looks like it only gets used with runCommand, so maybe setProxyServers can be moved to inside runCommand?

@damieng
Copy link
Contributor Author

damieng commented Jan 12, 2017

I originally had it in runCommand but the problem is that runCommand immediately passed back a BufferedProcess object that things attach to - this being async it couldn't do that immediately. Breaks everywhere.

@damieng damieng force-pushed the dg-apply-proxy-to-apm branch 3 times, most recently from b1dd1e8 to e37accd Compare January 19, 2017 22:23
@damieng damieng force-pushed the dg-apply-proxy-to-apm branch from e37accd to 6e310d4 Compare January 19, 2017 23:24
@damieng damieng merged commit 4fa5305 into master Jan 19, 2017
@damieng damieng deleted the dg-apply-proxy-to-apm branch January 19, 2017 23:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants