Fix dotenv not properly setup in Foreman

- 1 min read
rails foreman dotenv

When you’re dealing with multiple environment files in your local environment, such as .env.local or .env.staging, and you’re using Foreman to run the process, you might encounter an issue where the environment file doesn’t load as expected.

To resolve this issue, you simply need to add the -e option with the /dev/null argument in your Foreman command.

exec foreman start -e /dev/null -f Procfile.dev "$@"

For a more detailed explanation of this issue, you can check out this conversation

https://github.com/ddollar/foreman/pull/711