Skip to content

Instantly share code, notes, and snippets.

@fabiosoft
Created March 17, 2015 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiosoft/3073f18dd9e92cebeabe to your computer and use it in GitHub Desktop.
Save fabiosoft/3073f18dd9e92cebeabe to your computer and use it in GitHub Desktop.
Rails' built-in server binding default on 0.0.0.0 or different port
#!/usr/bin/env ruby2.2
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
# START NEW CODE
require "rails/commands/server"
module Rails
class Server
def default_options
super.merge({
:Host => '0.0.0.0',
:Port => 3000,
:environment => (ENV['RAILS_ENV'] || "development").dup,
:daemonize => false,
:debugger => false,
:pid => File.expand_path("tmp/pids/server.pid"),
:config => File.expand_path("config.ru")
})
end
end
end
# END NEW CODE
require 'rails/commands'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment