Vagrantfile: Provide a way to remove proxy from vagrant.

Fixes #5292
This commit is contained in:
Vishnu Ks 2017-09-15 00:40:14 +05:30 committed by Tim Abbott
parent 641d4c167b
commit fc59647a4a
2 changed files with 16 additions and 6 deletions

18
Vagrantfile vendored
View File

@ -26,7 +26,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# The Zulip development environment runs on 9991 on the guest. # The Zulip development environment runs on 9991 on the guest.
host_port = 9991 host_port = 9991
http_proxy = https_proxy = no_proxy = "" http_proxy = https_proxy = no_proxy = nil
host_ip_addr = "127.0.0.1" host_ip_addr = "127.0.0.1"
config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.synced_folder ".", "/vagrant", disabled: true
@ -48,20 +48,26 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end end
end end
config.vm.network "forwarded_port", guest: 9991, host: host_port, host_ip: host_ip_addr
if Vagrant.has_plugin?("vagrant-proxyconf") if Vagrant.has_plugin?("vagrant-proxyconf")
if http_proxy != "" if !http_proxy.nil?
config.proxy.http = http_proxy config.proxy.http = http_proxy
end end
if https_proxy != "" if !https_proxy.nil?
config.proxy.https = https_proxy config.proxy.https = https_proxy
end end
if https_proxy != "" if !no_proxy.nil?
config.proxy.no_proxy = no_proxy config.proxy.no_proxy = no_proxy
end end
elsif !http_proxy.nil? or !https_proxy.nil?
# This prints twice due to https://github.com/hashicorp/vagrant/issues/7504
# We haven't figured out a workaround.
puts 'You have specified value for proxy in ~/.zulip-vagrant-config file but did not ' \
'install the vagrant-proxyconf plugin. To install it, run `vagrant plugin install ' \
'vagrant-proxyconf` in a terminal. This error will appear twice.'
exit
end end
config.vm.network "forwarded_port", guest: 9991, host: host_port, host_ip: host_ip_addr
# Specify LXC provider before VirtualBox provider so it's preferred. # Specify LXC provider before VirtualBox provider so it's preferred.
config.vm.provider "lxc" do |lxc| config.vm.provider "lxc" do |lxc|
if command? "lxc-ls" if command? "lxc-ls"

View File

@ -982,6 +982,10 @@ Now run `vagrant up` in your terminal to install the development
server. If you ran `vagrant up` before and failed, you'll need to run server. If you ran `vagrant up` before and failed, you'll need to run
`vagrant destroy` first to clean up the failed installation. `vagrant destroy` first to clean up the failed installation.
**If you no longer want to use proxy with Vagrant, set values of HTTP_PROXY
and HTTPS_PROXY to `""` in `~/.zulip-vagrant-config` file and
restart Vagrant.**
You can also change the port on the host machine that Vagrant uses by You can also change the port on the host machine that Vagrant uses by
adding to your `~/.zulip-vagrant-config` file. E.g. if you set: adding to your `~/.zulip-vagrant-config` file. E.g. if you set: