set port from .env if specified

This commit is contained in:
Koen Van der Auwera
2012-05-11 14:17:03 +02:00
parent 003b466a17
commit 0b0324fed9
2 changed files with 8 additions and 1 deletions

View File

@@ -84,7 +84,7 @@ private ######################################################################
end
def base_port
options[:port] || 5000
options[:port] || environment["PORT"] || 5000
end
def kill_all(signal="SIGTERM")

View File

@@ -100,6 +100,13 @@ describe "Foreman::Engine", :fakefs do
engine.start
end
it "should set port from .env if specified" do
File.open(".env", "w") { |f| f.puts("PORT=8017") }
engine = Foreman::Engine.new("Procfile")
engine.send(:base_port).should == "8017"
engine.start
end
it "should be loaded relative to the Procfile" do
FileUtils.mkdir_p "/some/app"
File.open("/some/app/.env", "w") { |f| f.puts("FOO=qoo") }