tmatilai / vagrant-proxyconf

Vagrant plugin that configures the virtual machine to use proxies
MIT License
531 stars 74 forks source link

Perform system-wide NPM proxy configuration #91

Closed jonekdahl closed 9 years ago

jonekdahl commented 9 years ago

This pull request fixes #89. It uses the --global option of npm config which places the proxy configurations in the system wide configuration file. Tested on Ubuntu 14.04.

otahi commented 9 years ago

@johnbellone , Thank you very much for your pull request!

I have tried on my vagrant with your gem on CentOS 6.5. It works for me.

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  :
  config.proxy.http = "http://10.0.2.2:3128/"
  :
[vagrant@localhost /]$ npm config get proxy
http://10.0.2.2:3128/
[vagrant@localhost /]$ cat /usr/etc/npmrc
proxy = http://10.0.2.2:3128/
[vagrant@localhost /]$

@tmatilai If you don't have any indications, I think we can merge this PR.

tmatilai commented 9 years ago

@jonekdahl thanks! I don't understand how I missed that in the first place.

But setting the proxy to "foo" would normally result in DNS resolver error, wouldn't it? I think the correct way is to fetch the global config path with npm config get globalconfig. I'll add that and merge.

tmatilai commented 9 years ago

Ah, now I get it. Still feels dirty to me. :)

tmatilai commented 9 years ago

Uh, we would also need to make sure that the parent directory exists. I'll give up, this is just fine. =)