I want to set the default port when I do
rails s
to 3010, instead of having to say:
rails s -p 3010
...every time. Any ideas?
I want to set the default port when I do
rails s
to 3010, instead of having to say:
rails s -p 3010
...every time. Any ideas?
You can override the Port
by adding the following code to config/boot.rb
require 'rails/commands/server'
module Rails
class Server
alias :default_options_alias :default_options
def default_options
default_options_alias.merge!(:Port => 3010)
end
end
end
default_options_alias.merge!(:Host => '0.0.0.0')
in the above example to restore the former functionality if you need to access WEBrick from an outside machine. –
Altaf super.merge({Port: 3010})
instead of the alias merge line. Both versions are working for me under Rails 4.2.11.3, Ruby 2.2.3. –
Pyrotechnics © 2022 - 2024 — McMap. All rights reserved.