MakeSecret
Make Secret will create random values generated by SecureRandom.hex(64). It stores these values in key/value form either in memory on in a file. The ideal situation for Make Secret is if you have plain-text passwords that need to be hidden from source control.
Installation
Add this line to your application's Gemfile:
gem 'make_secret'
And then execute:
$ bundle
Or install it yourself as:
$ gem install make_secret
Usage
# Require the gem
require 'make_secret'
# To Store data in memory
memory_value = MakeSecret::Value.for( :key ) => result of SecureRandom.hex(64)
memory_value == MakeSecret::Value.for( :key ) => true
# To Store data in a file
file_value = MakeSecret::Value.for( :key, 'my_file' ) => result of SecureRandom.hex(64)
file_value = MakeSecret::Value.for( :key, 'my_file' ) => true
file_value == memory_value => false
Rails 4.0.0
I will be using this for new Rails applications. Open up config/initializers/secret_token.rb, and replace this:
MyApp::Application.config.secret_key_base = ' ... '
With this:
MyApp::Application.config.secret_key_base = MakeSecret::Value.for( :key_base, '.make_secret' )
Then add /.make_secret to the ignore file
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request