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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2014-10-15 19:26:15 +0400
committerValery Sizov <valery@gitlab.com>2014-10-15 21:03:25 +0400
commitb5763e91cdeaba55b3c426129ba3c4f9638c5eb1 (patch)
tree942dddd23f2e8f4738b27aeb25bfe72ea928e852 /config
parentf7342ce56764aaf6465bca74239955778c25107b (diff)
add gitlab-shell identification
Diffstat (limited to 'config')
-rw-r--r--config/initializers/gitlab_shell_secret_token.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/config/initializers/gitlab_shell_secret_token.rb b/config/initializers/gitlab_shell_secret_token.rb
new file mode 100644
index 00000000000..8d2b771e535
--- /dev/null
+++ b/config/initializers/gitlab_shell_secret_token.rb
@@ -0,0 +1,19 @@
+# Be sure to restart your server when you modify this file.
+
+require 'securerandom'
+
+# Your secret key for verifying the gitlab_shell.
+
+
+secret_file = Rails.root.join('.gitlab_shell_secret')
+gitlab_shell_symlink = File.join(Gitlab.config.gitlab_shell.path, '.gitlab_shell_secret')
+
+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
+
+if File.exist?(Gitlab.config.gitlab_shell.path) && !File.exist?(gitlab_shell_symlink)
+ FileUtils.symlink(secret_file, gitlab_shell_symlink)
+end \ No newline at end of file