Welcome to mirror list, hosted at ThFree Co, Russian Federation.

generate_session_secret.rake « tasks « lib - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28af3ef6e444253b9bef9a89baa3ae7b11f75f10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

namespace :generate do
  desc 'Generates a Session Secret Token'
  task :secret_token do
    path = Rails.root.join("config", "initializers", "secret_token.rb")
    secret = SecureRandom.hex(40)
    File.open(path, "w") do |f|
      f.write <<EOF
# Be sure to restart your server when you modify this file.

# Your secret key is used 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.
# You can use `rake secret` to generate a secure secret key.

# Make sure your secret_key_base is kept private
# if you're sharing your code publicly.
Diaspora::Application.config.secret_key_base = '#{secret}'
EOF
    end

  end
end