简体   繁体   English

如何为Webrick设置默认端口?

[英]How to set default port for Webrick?

I want to set the default port when I do 我想设置默认端口

rails s

to 3010, instead of having to say: 到3010,而不是说:

rails s -p 3010

...every time. ...每次。 Any ideas? 有任何想法吗?

You can override the Port by adding the following code to config/boot.rb 您可以通过将以下代码添加到config/boot.rb来覆盖Port

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM