By lhagemann
Using the 1-Click Ruby on Rails on Ubuntu 14.04 Image, I’m getting the following error on initial request to the app:
ERROR: app error: Missing `secret_token` and `secret_key_base` for 'production' environment, set these values in `config/secrets.yml` (RuntimeError)
my config/secrets.yml file includes the following:
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
secret_token: <%= ENV["SECRET_KEY_BASE"] %>
and I’ve set ENV["SECRET_KEY_BASE"]
stack: ‘rails’, ‘4.2.0’ ruby ‘2.1.3’ unicorn (4.8.3)
all my reading says that secret_token is no longer used in Rails 4.2.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I use this with capistrano. it works nice:
I create a file: config/local_env.yml, put my variables there
and then in application rb
config.before_configuration do env_file = File.join(Rails.root, ‘config’, ‘local_env.yml’) YAML.load(File.open(env_file)).each do |key, value| ENV[key.to_s] = value end if File.exists?(env_file) end
The only solution I found was to put the secret_key_base && secret_token values directly into secrets.yml.
apparently Unicorn can’t read from the Environment Variables. (I have nothing to back that up, only conjecture and a comment on StackOverflow which identified that as a solution to a similar issue)
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.