I set the port as 3000 in my application.yml (figaro managing env variables)
rails s
uses port 3000
but when I run foreman start
(as recommended by Her
port ENV['PORT'] || 3000
This line says that you will attempt to use ENV['PORT']
first and if that doesn't exist, you will fall back to using 3000
as the port number. So are you defining PORT
environment variable anywhere prior to foreman
starting? config/application.yml
environment variables only will be loaded after the rails server starts, so it's no use defining port number here.
You can try adding
PORT=3000
in .env
file in the root of the project directory.
Source: https://devcenter.heroku.com/articles/getting-started-with-rails5#procfile