Skip to content
  • schneems's avatar
    7e2a79fa
    Backport Send user_supplied_options to server · 7e2a79fa
    schneems authored
    Currently when Puma gets a `:Port` it doesn't know if it is Rails' default port or if it is one that is specified by a user. Because of this it assumes that the port passed in is always a user defined port and therefor 3000 always "wins" even if you specify `port` inside of the `config/puma.rb` file when booting your server with `rails s`.
    
    The fix is to record the options that are explicitly passed in from the user and pass those to the Puma server (or all servers really). Puma then has enough information to know when `:Port` is the default and when it is user defined. I went ahead and did this for all values rails server exposes as server side options for completeness.
    
    The hardest thing was converting the input say `-p` or `--port` into the appropriate "name", in this case `Port`. There may be a more straightforward way to do this with Thor, but I'm not an expert here.
    
    Move logic for parsing user options to method
    
    Better variable name for iteration
    
    Explicitly test `--port` user input
    
    ✂️
    
    Update array if environment variables are used
    7e2a79fa
    Backport Send user_supplied_options to server
    schneems authored
    Currently when Puma gets a `:Port` it doesn't know if it is Rails' default port or if it is one that is specified by a user. Because of this it assumes that the port passed in is always a user defined port and therefor 3000 always "wins" even if you specify `port` inside of the `config/puma.rb` file when booting your server with `rails s`.
    
    The fix is to record the options that are explicitly passed in from the user and pass those to the Puma server (or all servers really). Puma then has enough information to know when `:Port` is the default and when it is user defined. I went ahead and did this for all values rails server exposes as server side options for completeness.
    
    The hardest thing was converting the input say `-p` or `--port` into the appropriate "name", in this case `Port`. There may be a more straightforward way to do this with Thor, but I'm not an expert here.
    
    Move logic for parsing user options to method
    
    Better variable name for iteration
    
    Explicitly test `--port` user input
    
    ✂️
    
    Update array if environment variables are used
Loading