Skip to content

Instantly share code, notes, and snippets.

@mikhailbortnyk
Created January 24, 2013 16:04
Show Gist options
  • Save mikhailbortnyk/4623907 to your computer and use it in GitHub Desktop.
Save mikhailbortnyk/4623907 to your computer and use it in GitHub Desktop.
config/initializers/secret_token.rb
require 'clickworker-secure-config/helper'; include Clickworker::SecureConfig::Helper
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
ClickworkerProfile::Application.config.secret_token = get_secret_by_key('profile.secret_token') || 'd69b09956e0ccef4351f239dcbbc3265'
@mikhailbortnyk
Copy link
Author

so, how it works. get_secret_by_key checks config.secure_reader and if it nil - returns nil, so part after || will be used. if config.secure_reader is not nil (it means we are not at development or test env) - it reads secret_token from securified file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment