mirror of https://github.com/zulip/zulip.git
Add support for using and configuring vagrant-proxyconf.
Users can now specify proxy settings for vagrant in a new ~/.zulip-vagrant-config configuration file.
This commit is contained in:
parent
35f70e9dac
commit
859a4eeaf4
|
@ -90,6 +90,29 @@ environment][using-dev].
|
|||
|
||||
[using-dev]: #using-the-development-environment
|
||||
|
||||
## Specifying a proxy
|
||||
|
||||
If you need to use a proxy server to access the Internet, you will
|
||||
need to specify the proxy settings before running `Vagrant up`.
|
||||
First, install the Vagrant plugin `vagrant-proxyconf`:
|
||||
|
||||
```
|
||||
vagrant plugin install vagrant-proxyconf.
|
||||
```
|
||||
|
||||
Then create `~/.zulip-vagrant-config` and add the following lines to
|
||||
it (with the appropriate values in it for your proxy):
|
||||
|
||||
```
|
||||
HTTP_PROXY http://proxy_host:port
|
||||
HTTPS_PROXY http://proxy_host:port
|
||||
NO_PROXY localhost,127.0.0.1,.example.com
|
||||
|
||||
```
|
||||
|
||||
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
|
||||
`vagrant destroy` first to clean up the failed installation.
|
||||
|
||||
Using provision.py without Vagrant
|
||||
----------------------------------
|
||||
|
|
|
@ -18,6 +18,34 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
config.vm.synced_folder ".", "/srv/zulip"
|
||||
|
||||
proxy_config_file = ENV['HOME'] + "/.zulip-vagrant-config"
|
||||
if File.file?(proxy_config_file)
|
||||
http_proxy = https_proxy = no_proxy = ""
|
||||
|
||||
IO.foreach(proxy_config_file) do |line|
|
||||
line.chomp!
|
||||
key, value = line.split(nil, 2)
|
||||
case key
|
||||
when /^([#;]|$)/; # ignore comments
|
||||
when "HTTP_PROXY"; http_proxy = value
|
||||
when "HTTPS_PROXY"; https_proxy = value
|
||||
when "NO_PROXY"; no_proxy = value
|
||||
end
|
||||
end
|
||||
|
||||
if Vagrant.has_plugin?("vagrant-proxyconf")
|
||||
if http_proxy != ""
|
||||
config.proxy.http = http_proxy
|
||||
end
|
||||
if https_proxy != ""
|
||||
config.proxy.https = https_proxy
|
||||
end
|
||||
if https_proxy != ""
|
||||
config.proxy.no_proxy = no_proxy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Specify LXC provider before VirtualBox provider so it's preferred.
|
||||
config.vm.provider "lxc" do |lxc|
|
||||
if command? "lxc-ls"
|
||||
|
|
Loading…
Reference in New Issue