Skip to content

Instantly share code, notes, and snippets.

@joncode
Last active December 20, 2015 16:19
Show Gist options
  • Select an option

  • Save joncode/6160888 to your computer and use it in GitHub Desktop.

Select an option

Save joncode/6160888 to your computer and use it in GitHub Desktop.
Removing any SECRET_TOKEN from source control
1. make a new secret token at the command line
rake secret
2. set the var in staging and production, run for each
heroku config:set SECRET_TOKEN=9813745901y30fhi2304ify1034yf1083y5r013yfr0813gf9 --remote <stagingORproduction>
3. remove the secret_token.rb code in favor of the GETTER for ENV['SECRET_TOKEN"]
YourAPP::Application.config.secret_key_base = if Rails.env.development? or Rails.env.test?
"3eb6db5a9026c547c72708438d496d942e976b252138db7e4e0ee5edd7539457d3ed0fa02ee5e7179420ce5290462018591adaf5f42adcf855da04877827def2"
else
ENV['SECRET_TOKEN']
end
4. done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment