Skip to content

Instantly share code, notes, and snippets.

@derekrockwell
Created May 20, 2013 04:53
Show Gist options
  • Save derekrockwell/5610486 to your computer and use it in GitHub Desktop.
Save derekrockwell/5610486 to your computer and use it in GitHub Desktop.
Good way of handling secret tokens within apps (leveraging Heroku config variables or some other server based environment variables) Source: http://daniel.fone.net.nz/blog/2013/05/20/a-better-way-to-manage-the-rails-secret-token/
MyApp::Application.config.secret_token = if Rails.env.development? or Rails.env.test?
('x' * 30) # meets minimum requirement of 30 chars long
else
ENV['SECRET_TOKEN']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment