tmatilai / vagrant-proxyconf

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

NPM proxy only configured for root #89

Closed jonekdahl closed 9 years ago

jonekdahl commented 9 years ago

I have a Vagrant project which uses a (privileged) shell provisioner. The script uses apt-get to install NPM, and I have the following vagrant-proxyconf snippet in my Vagrantfile.

if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://user:pwd@proxy.example.com:80"
    config.proxy.https    = "http://user:pwd@proxy.example.com:80"
    config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
end

config.vm.provision "shell", path: "bootstrap.sh"

When the provisioning is done, /root/.npmrc contains the above http/https proxy settings.

Now, when I ssh into the VM and run npm as the vagrant user, the proxy settings are not being applied. Presumably, you could use npm config --global instead. Global NPM configuration ends up /etc/npmrc, and would apply for all users on the Vagrant box.

PS. Thanks for this plugin, awesome work!

otahi commented 9 years ago

Hi, @jonekdahl

Thank you for your notifying. I am not familiar with npm, but I understand vagrant-proxyconfig uses npm config without --global

I think npm can be used not only by root but also usual users.

Can you create a pull request?

jonekdahl commented 9 years ago

@otahi, I created a pull request for this.

otahi commented 9 years ago

@jonekdahl Yes. I appreciate your pull request!