0

Kind of pulling my hair out here. Other than hard coding the secret_key_base into secrets.yml, I cannot figure out a way to get it into my Rails 4.1 app running on Ubuntu 14 and deployed via the Rubber gem using unicorn and nginx.

I have tried the following in secrets.yml:

production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

and in my /etc/environment:

export SECRET_KEY_BASE=ivegotalovelybunchofcoconuts

That gives me: app error: Missing secret_token and secret_key_base for 'production' environment, set these values in config/secrets.yml

I tried the figaro gem and put this into my application.rb

config.secret_key_base = Figaro.env.SECRET_KEY_BASE

Same error.

If I launch a console I can see the variables no problem:

irb(main):004:0> Rails.application.secrets.secret_key_base => "ivegotalovelybunchofcoconuts" irb(main):005:0> Figaro.env.SECRET_KEY_BASE => "ivegotalovelybunchofcoconuts"

phil
  • 4,668
  • 4
  • 33
  • 51
  • Did you set secret_token too? I see rails complains about it, too. Maybe the message is generic and complains about both even thought one is available? – Julien Portalier Jun 05 '15 at 05:10
  • Check here http://stackoverflow.com/questions/23180650/how-to-solve-error-missing-secret-key-base-for-production-environment-on-h – Nitin Rajan Jun 05 '15 at 05:12
  • I have written a page to output the values and I can see that in the Unicorn running version (i.e. not console) that the values are blank. It is not picking up things from the environment. And yes Nitin I found that page. That is why all of my examples of what I have done are from there. It didn't work. – phil Jun 06 '15 at 05:41

0 Answers0