Selaa lähdekoodia

Merge pull request #857 from edx/856-vagrant-port-forwarding

* Vagrantfile: Add an option to forward all ports to the vagrant host that have been ex...
Guillaume J. Charmes 12 vuotta sitten
vanhempi
commit
f413fb8e56
1 muutettua tiedostoa jossa 15 lisäystä ja 0 poistoa
  1. 15 0
      Vagrantfile

+ 15 - 0
Vagrantfile

@@ -5,6 +5,7 @@ BOX_NAME = ENV['BOX_NAME'] || "ubuntu"
 BOX_URI = ENV['BOX_URI'] || "http://files.vagrantup.com/precise64.box"
 AWS_REGION = ENV['AWS_REGION'] || "us-east-1"
 AWS_AMI    = ENV['AWS_AMI']    || "ami-d0f89fb9"
+FORWARD_DOCKER_PORTS = ENV['FORWARD_DOCKER_PORTS']
 
 Vagrant::Config.run do |config|
   # Setup virtual machine box. This VM configuration code is always executed.
@@ -71,3 +72,17 @@ Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
     config.vm.box_url = BOX_URI
   end
 end
+
+if !FORWARD_DOCKER_PORTS.nil?
+    Vagrant::VERSION < "1.1.0" and Vagrant::Config.run do |config|
+        (49000..49900).each do |port|
+            config.vm.forward_port port, port
+        end
+    end
+
+    Vagrant::VERSION >= "1.1.0" and Vagrant.configure("2") do |config|
+        (49000..49900).each do |port|
+            config.vm.network :forwarded_port, :host => port, :guest => port
+        end
+    end
+end