With foreman, I'm trying to start my rails app using two .env files.
One is the regular .env file, but then a second one has extra variables to load. I'm trying to use the method mentioned in this guide to keep config variables out of code: https://devcenter.heroku.com/articles/config-vars
Here is my Procfile:
web: bundle exec rails server thin -p $PORT --env $RACK_ENV,var.env
My problem is that foreman doesn't seem to want to take the two arguments for --env, even though the docs say that it should be possible:
-e, --env
Specify an alternate environment file. You can specify more than one file by using: --env file1,file2.
When I try to run it with "foreman start," I get the error:
06:22:46 web.1 | You did not specify how you would like Rails to report deprecation notices for your development,var.env environment, please set config.active_support.deprecation to :log, :notify or :stderr at config/environments/development,var.env.rb
It just doesn't seem to want to split "development,var.env" and process them separately. When I looked at the foreman code, it looks like it should just do a simple split on the comma, so I can't tell if I'm doing something wrong or it's a bug.
I didn't use that feature yet but from the docs I would say your are trying to specify the command line parameter in the wrong place. Instead of adding it to the process in the Procfile
you should add it to the foreman
command itself:
foreman start --env .env,.env.local
That way the environment is set for all processes started by foreman.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With