HNHacker News
TopNewBestAskShowJobs

ryannielson

9 karma · joined January 26, 2013

submissionscomments
ryannielson··on A Better Way to Manage the Rails Secret Token
Something more like the following is probably a better solution:

if ENV['SECRET_TOKEN'].blank? raise 'SECRET_TOKEN environment variable is not set!' end

App::Application.config.secret_token = ENV['SECRET_TOKEN']

ryannielson··on A Better Way to Manage the Rails Secret Token
I wrote a gem called envious that could be used as an alternative to dotenv: https://github.com/RyanNielson/envious from what I can see it does a few things dotenv doesn't. Good guide though, I wrote Envious when I found out this problem existed.
ryannielson··on Secrets in the code
I wrote a gem that I've used to help with the secret key problem in the past. It's called Envious: https://github.com/RyanNielson/envious

Basically it adds a yml file, that is added to .gitignore, with configuration settings that get added to ENV. It can even send your environment variables to Heroku using a Rake task. There are some examples on the page. You can use it to have different secret keys depending on your Rails environment as well.