Permalink
Browse files

Merge pull request #25688 from mahnunchik/host-env-var

Use the HOST environment variable for rails server #25677
  • Loading branch information...
guilleiguaran committed Jul 8, 2016
2 parents 48e8056 + e17d727 commit 8e74f71bd1bc241af62ff4613ea4db52003bc3a9
Showing with 8 additions and 0 deletions.
  1. +1 −0 railties/lib/rails/commands/server.rb
  2. +7 −0 railties/test/commands/server_test.rb
@@ -90,6 +90,7 @@ def middleware
def default_options
super.merge({
Port: ENV.fetch('PORT', 3000).to_i,
Host: ENV.fetch('HOST', 'localhost').dup,
DoNotReverseLookup: true,
environment: (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || "development").dup,
daemonize: false,
@@ -51,6 +51,13 @@ def test_environment_with_port
end
end
def test_environment_with_host
switch_env "HOST", "1.2.3.4" do
server = Rails::Server.new
assert_equal "1.2.3.4", server.options[:Host]
end
end
def test_caching_without_option
args = []
options = Rails::Server::Options.new.parse!(args)

0 comments on commit 8e74f71

Please sign in to comment.