aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/server/server_command.rb
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2017-03-21 19:07:40 -0400
committerJon Moss <me@jonathanmoss.me>2017-03-21 19:07:40 -0400
commitd0accc23b3d01a7d35e73c5dc901014d883ef5f7 (patch)
tree9c344c7ee7abd7a5bb0a009c86b9b1b8b31ee28d /railties/lib/rails/commands/server/server_command.rb
parent88b16843f67bcd96395444ba8f139895351da0bc (diff)
downloadrails-d0accc23b3d01a7d35e73c5dc901014d883ef5f7.tar.gz
rails-d0accc23b3d01a7d35e73c5dc901014d883ef5f7.tar.bz2
rails-d0accc23b3d01a7d35e73c5dc901014d883ef5f7.zip
CLI arg "host" has precedence over ENV var "host"
This is a regression from when the server command switched to its own argument parser, as opposed to Rack's. Rack's argument parser, when provided with a "host" argument, gives that value precedence over environment variables.
Diffstat (limited to 'railties/lib/rails/commands/server/server_command.rb')
-rw-r--r--railties/lib/rails/commands/server/server_command.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb
index 7e8c86fb49..278fe63c51 100644
--- a/railties/lib/rails/commands/server/server_command.rb
+++ b/railties/lib/rails/commands/server/server_command.rb
@@ -188,10 +188,12 @@ module Rails
end
def host
- unless (default_host = options[:binding])
+ if options[:binding]
+ options[:binding]
+ else
default_host = environment == "development" ? "localhost" : "0.0.0.0"
+ ENV.fetch("HOST", default_host)
end
- ENV.fetch("HOST", default_host)
end
def environment