When I navigate to my Rails production site, I get:
*** Exception RuntimeError in Rack application object (Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`) (process 29032, thread 0x9b81a60(Worker 1)):
I see many solutions to this error is to export a environment variable with export SECRET_KEY_BASE='a long string generated by running rake secret
However that didn't work for me (I get the same error). I had to include in config/environments/production.rb
:
config.secret_key_base = "a long string generated by running rake secret"
to solve this error.
My question is, is this the right way, since the practice is to not commit the secret key? Is there any way to make Rails read from the environment variable?
I'm using Ubuntu 14.04.1, Apache2, Phusion Passenger stack.
[http://stackoverflow.com/questions/23180650/how-to-solve-error-missing-secret-key-base-for-production-environment-on-h](http://stackoverflow.com/questions/23180650/how-to-solve-error-missing-secret-key-base-for-production-environment-on-h) cheers – Riliwan Balogun Nov 15 '15 at 21:44