aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Stephenson <sam@37signals.com>2005-11-21 06:19:25 +0000
committerSam Stephenson <sam@37signals.com>2005-11-21 06:19:25 +0000
commit2b6e2bfed79e30d6d72fcac6a068e9fcbbf4f610 (patch)
tree30d4ba7085541caa0e3fabafdbadda05c8c77b8d
parent9a37fd44cb7df94d7b7652d03251bb6cd0675b45 (diff)
downloadrails-2b6e2bfed79e30d6d72fcac6a068e9fcbbf4f610.tar.gz
rails-2b6e2bfed79e30d6d72fcac6a068e9fcbbf4f610.tar.bz2
rails-2b6e2bfed79e30d6d72fcac6a068e9fcbbf4f610.zip
Have the lighttpd server script report the actual ip to which the server is bound. Closes #2903.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3123 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/commands/servers/lighttpd.rb9
2 files changed, 8 insertions, 3 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index f6dfa85fb3..9cf4f6c10c 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Have the lighttpd server script report the actual ip to which the server is bound. #2903. [Adam]
+
* Add plugin library directories to the load path after the lib directory so that libraries in the lib directory get precedence. #2910. [james.adam@gmail.com]
* Make help for the console command more explicit about how to specify the desired environment in which to run the console. #2911. [anonymous]
diff --git a/railties/lib/commands/servers/lighttpd.rb b/railties/lib/commands/servers/lighttpd.rb
index a35bc984c7..16baf1e367 100644
--- a/railties/lib/commands/servers/lighttpd.rb
+++ b/railties/lib/commands/servers/lighttpd.rb
@@ -19,8 +19,11 @@ unless File.exist?(config_file)
FileUtils.cp source, config_file
end
-port = IO.read(config_file).scan(/^server.port\s*=\s*(\d+)/).first rescue 3000
-puts "=> Rails application started on http://0.0.0.0:#{port}"
+config = IO.read(config_file)
+default_port, default_ip = 3000, '0.0.0.0'
+port = config.scan(/^server.port\s*=\s*(\d+)/).first rescue default_port
+ip = config.scan(/^server.bind\s*=\s*"([^"]+)"/).first rescue default_ip
+puts "=> Rails application started on http://#{ip || default_ip}:#{port || default_port}"
tail_thread = nil
@@ -53,4 +56,4 @@ end
trap(:INT) { exit }
`lighttpd #{!detach ? "-D " : ""}-f #{config_file}`
-tail_thread.kill if tail_thread \ No newline at end of file
+tail_thread.kill if tail_thread