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

gitlab_shell_secret_token.rb « initializers « config - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 751fccead07c09537c7820da47a16cf2c01dcaa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Be sure to restart your server when you modify this file.

require 'securerandom'

# Your secret key for verifying the gitlab_shell.


secret_file = Gitlab.config.gitlab_shell.secret_file

unless File.exist? secret_file
  # Generate a new token of 16 random hexadecimal characters and store it in secret_file.
  token = SecureRandom.hex(16)
  File.write(secret_file, token)
end

link_path = File.join(Gitlab.config.gitlab_shell.path, '.gitlab_shell_secret')
if File.exist?(Gitlab.config.gitlab_shell.path) && !File.exist?(link_path)
  FileUtils.symlink(secret_file, link_path)
end