samuelkadolph / unicorn-rails

unicorn-rails is a simple gem that sets the default server for rack (and rails) to unicorn.
MIT License
127 stars 22 forks source link

Conditional Unicorn Config #21

Open MhdSyrwan opened 8 years ago

MhdSyrwan commented 8 years ago

Sometimes we need to write some conditional config in unicorn like:

if ENV['RAILS_PORT'] || ENV['PORT']
  listen '127.0.0.1:' + (ENV['RAILS_PORT'] || ENV['PORT'])
end

But that didn't work with this gem, after some digging i found this line of code https://github.com/samuelkadolph/unicorn-rails/blob/master/lib/unicorn_rails.rb#L27 which tests the presence of listen using a regex which will not work obviously in case of conditional configuration.

Any thoughts about this ?