2023-11-26 14:07:17 +00:00
|
|
|
# Redmine - project management software
|
|
|
|
|
# Copyright (C) 2006-2023 Jean-Philippe Lang
|
|
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
2012-04-25 17:17:49 +00:00
|
|
|
desc 'Generates a secret token for the application.'
|
2009-02-21 11:04:50 +00:00
|
|
|
|
2012-04-25 17:17:49 +00:00
|
|
|
file 'config/initializers/secret_token.rb' do
|
|
|
|
|
path = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb')
|
|
|
|
|
secret = SecureRandom.hex(40)
|
2009-02-21 11:04:50 +00:00
|
|
|
File.open(path, 'w') do |f|
|
|
|
|
|
f.write <<"EOF"
|
2022-09-21 06:58:10 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2012-04-25 17:17:49 +00:00
|
|
|
# This file was generated by 'rake generate_secret_token', and should
|
|
|
|
|
# not be made visible to public.
|
2009-02-21 11:04:50 +00:00
|
|
|
# If you have a load-balancing Redmine cluster, you will need to use the
|
|
|
|
|
# same version of this file on each machine. And be sure to restart your
|
|
|
|
|
# server when you modify this file.
|
2012-04-25 17:17:49 +00:00
|
|
|
#
|
2009-02-21 11:04:50 +00:00
|
|
|
# Your secret key for verifying cookie session data integrity. If you
|
|
|
|
|
# change this key, all old sessions 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.
|
2015-01-17 17:02:55 +00:00
|
|
|
RedmineApp::Application.config.secret_key_base = '#{secret}'
|
2009-02-21 11:04:50 +00:00
|
|
|
EOF
|
|
|
|
|
end
|
|
|
|
|
end
|
2009-12-30 00:46:48 +00:00
|
|
|
|
2012-04-25 17:17:49 +00:00
|
|
|
desc 'Generates a secret token for the application.'
|
|
|
|
|
task :generate_secret_token => ['config/initializers/secret_token.rb']
|