{"action":"created","issue":{"url":"https://api.github.com/repos/puma/puma/issues/939","repository_url":"https://api.github.com/repos/puma/puma","labels_url":"https://api.github.com/repos/puma/puma/issues/939/labels{/name}","comments_url":"https://api.github.com/repos/puma/puma/issues/939/comments","events_url":"https://api.github.com/repos/puma/puma/issues/939/events","html_url":"https://github.com/puma/puma/issues/939","id":144627947,"number":939,"title":"Conditional port is ignored in puma.rb","user":{"login":"micahlisonbee","id":1928295,"avatar_url":"https://avatars.githubusercontent.com/u/1928295?v=3","gravatar_id":"","url":"https://api.github.com/users/micahlisonbee","html_url":"https://github.com/micahlisonbee","followers_url":"https://api.github.com/users/micahlisonbee/followers","following_url":"https://api.github.com/users/micahlisonbee/following{/other_user}","gists_url":"https://api.github.com/users/micahlisonbee/gists{/gist_id}","starred_url":"https://api.github.com/users/micahlisonbee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micahlisonbee/subscriptions","organizations_url":"https://api.github.com/users/micahlisonbee/orgs","repos_url":"https://api.github.com/users/micahlisonbee/repos","events_url":"https://api.github.com/users/micahlisonbee/events{/privacy}","received_events_url":"https://api.github.com/users/micahlisonbee/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2016-03-30T15:27:05Z","updated_at":"2016-04-22T14:48:11Z","closed_at":"2016-04-12T16:42:55Z","body":"When I put a conditional for the port value it seems to get ignored and 5000 is used. When I define the port explicitly it works. Here is my puma.rb, the ` ENV['PORT']` is not defined in this case, running locally.\r\n\r\nWhen I do `port 3001` it works.\r\n\r\nUsing `Puma 3.0.2`\r\n\r\n```\r\nworkers Integer(ENV['WEB_CONCURRENCY'] || 2)\r\nthreads_count = Integer(ENV['MAX_THREADS'] || 5)\r\nthreads threads_count, threads_count\r\n\r\npreload_app!\r\n\r\nrackup      DefaultRackup\r\nport        ENV['PORT'] || 3001\r\nenvironment ENV['RACK_ENV'] || 'development'\r\n\r\non_worker_boot do\r\n  # Worker specific setup for Rails 4.1+\r\n  # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot\r\n  ActiveRecord::Base.establish_connection\r\n\r\n  if defined?(Resque)\r\n     Resque.redis = ENV[\"<redis-uri>\"] || \"redis://127.0.0.1:6379\"\r\n  end\r\n  \r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/puma/puma/issues/comments/213457066","html_url":"https://github.com/puma/puma/issues/939#issuecomment-213457066","issue_url":"https://api.github.com/repos/puma/puma/issues/939","id":213457066,"user":{"login":"schneems","id":59744,"avatar_url":"https://avatars.githubusercontent.com/u/59744?v=3","gravatar_id":"","url":"https://api.github.com/users/schneems","html_url":"https://github.com/schneems","followers_url":"https://api.github.com/users/schneems/followers","following_url":"https://api.github.com/users/schneems/following{/other_user}","gists_url":"https://api.github.com/users/schneems/gists{/gist_id}","starred_url":"https://api.github.com/users/schneems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schneems/subscriptions","organizations_url":"https://api.github.com/users/schneems/orgs","repos_url":"https://api.github.com/users/schneems/repos","events_url":"https://api.github.com/users/schneems/events{/privacy}","received_events_url":"https://api.github.com/users/schneems/received_events","type":"User","site_admin":false},"created_at":"2016-04-22T14:48:11Z","updated_at":"2016-04-22T14:48:11Z","body":"Agreed binding to multiple ports would be non-obvious. \r\n\r\nI'm thinking either we could make it more clear where the values are coming from, maybe listing out the flags that are passed in via the options hash. Alternatively we could add some logic in Rails to not specify port if puma is bundled and a `config/puma.rb` file exists.\r\n"}}