summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2015-02-16 13:16:26 +0100
committerJakub Jirutka <jakub@jirutka.cz>2015-05-16 21:46:06 +0200
commited3298fc019d224b9048901972ac03e5272a3b25 (patch)
treebbdaea24522778869f106fdfe99f691feb8ccbc7 /config
parent35729671fb3a123ddeb7b2b1cda446fd661bd4e6 (diff)
downloadgitlab-ce-ed3298fc019d224b9048901972ac03e5272a3b25.tar.gz
Allow to configure gitlab_shell_secret location
Diffstat (limited to 'config')
-rw-r--r--config/gitlab.yml.example4
-rw-r--r--config/initializers/1_settings.rb1
-rw-r--r--config/initializers/gitlab_shell_secret_token.rb8
3 files changed, 9 insertions, 4 deletions
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index bd2081688d1..fbc7f515f34 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -245,6 +245,10 @@ production: &base
repos_path: /home/git/repositories/
hooks_path: /home/git/gitlab-shell/hooks/
+ # File that contains the secret key for verifying access for gitlab-shell.
+ # Default is '.gitlab_shell_secret' relative to Rails.root (i.e. root of the GitLab app).
+ # secret_file: /home/git/gitlab/.gitlab_shell_secret
+
# Git over HTTP
upload_pack: true
receive_pack: true
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index e5ac66a2323..2351ef7b0ce 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -148,6 +148,7 @@ Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?
Settings['gitlab_shell'] ||= Settingslogic.new({})
Settings.gitlab_shell['path'] ||= Settings.gitlab['user_home'] + '/gitlab-shell/'
Settings.gitlab_shell['hooks_path'] ||= Settings.gitlab['user_home'] + '/gitlab-shell/hooks/'
+Settings.gitlab_shell['secret_file'] ||= Rails.root.join('.gitlab_shell_secret')
Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil?
Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil?
Settings.gitlab_shell['repos_path'] ||= Settings.gitlab['user_home'] + '/repositories/'
diff --git a/config/initializers/gitlab_shell_secret_token.rb b/config/initializers/gitlab_shell_secret_token.rb
index e7c9f0ba7c2..751fccead07 100644
--- a/config/initializers/gitlab_shell_secret_token.rb
+++ b/config/initializers/gitlab_shell_secret_token.rb
@@ -5,8 +5,7 @@ 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')
+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.
@@ -14,6 +13,7 @@ unless File.exist? secret_file
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)
+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