Skip to content

Commit

Permalink
Vagrantfile: Provide a way to remove proxy from vagrant.
Browse files Browse the repository at this point in the history
Fixes #5292
  • Loading branch information
hackerkid authored and timabbott committed Sep 15, 2017
1 parent 641d4c1 commit fc59647
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Vagrantfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions docs/dev-env-first-time-contributors.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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:


Expand Down

0 comments on commit fc59647

Please sign in to comment.