Mercurial > hg > soundsoftware-site
annotate lib/tasks/initializers.rake @ 1628:9c5f8e24dadc live tip
Quieten this cron script
author | Chris Cannam |
---|---|
date | Tue, 25 Aug 2020 11:38:49 +0100 |
parents | 433d4f72a19b |
children |
rev | line source |
---|---|
Chris@1115 | 1 desc 'Generates a secret token for the application.' |
Chris@0 | 2 |
Chris@1115 | 3 file 'config/initializers/secret_token.rb' do |
Chris@1115 | 4 path = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb') |
Chris@1115 | 5 secret = SecureRandom.hex(40) |
Chris@0 | 6 File.open(path, 'w') do |f| |
Chris@0 | 7 f.write <<"EOF" |
Chris@1115 | 8 # This file was generated by 'rake generate_secret_token', and should |
Chris@1115 | 9 # not be made visible to public. |
Chris@0 | 10 # If you have a load-balancing Redmine cluster, you will need to use the |
Chris@0 | 11 # same version of this file on each machine. And be sure to restart your |
Chris@0 | 12 # server when you modify this file. |
Chris@1115 | 13 # |
Chris@0 | 14 # Your secret key for verifying cookie session data integrity. If you |
Chris@0 | 15 # change this key, all old sessions will become invalid! Make sure the |
Chris@0 | 16 # secret is at least 30 characters and all random, no regular words or |
Chris@0 | 17 # you'll be exposed to dictionary attacks. |
Chris@1115 | 18 RedmineApp::Application.config.secret_token = '#{secret}' |
Chris@0 | 19 EOF |
Chris@0 | 20 end |
Chris@0 | 21 end |
Chris@0 | 22 |
Chris@1115 | 23 desc 'Generates a secret token for the application.' |
Chris@1115 | 24 task :generate_secret_token => ['config/initializers/secret_token.rb'] |