You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

initializers.rake 1000B

123456789101112131415161718192021222324
  1. desc 'Generates a secret token for the application.'
  2. file 'config/initializers/secret_token.rb' do
  3. path = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb')
  4. secret = SecureRandom.hex(40)
  5. File.open(path, 'w') do |f|
  6. f.write <<"EOF"
  7. # This file was generated by 'rake generate_secret_token', and should
  8. # not be made visible to public.
  9. # If you have a load-balancing Redmine cluster, you will need to use the
  10. # same version of this file on each machine. And be sure to restart your
  11. # server when you modify this file.
  12. #
  13. # Your secret key for verifying cookie session data integrity. If you
  14. # change this key, all old sessions will become invalid! Make sure the
  15. # secret is at least 30 characters and all random, no regular words or
  16. # you'll be exposed to dictionary attacks.
  17. RedmineApp::Application.config.secret_key_base = '#{secret}'
  18. EOF
  19. end
  20. end
  21. desc 'Generates a secret token for the application.'
  22. task :generate_secret_token => ['config/initializers/secret_token.rb']