Foreman/Puma isn't using the specified port in dev env

后端 未结 3 2059
旧时难觅i
旧时难觅i 2021-02-19 06:50

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

3条回答
  •  庸人自扰
    2021-02-19 07:07

    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

提交回复
热议问题