summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-04-10 21:03:37 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-04-10 21:03:37 +0300
commit46b92499f1778775e31a1c27cfd1013586cd9cdf (patch)
treede78dbd5620610ba7379f65edcded45d64241efa
parentfd677db79be3dfa92e77f7a664a65c6aa24607ff (diff)
parent9beb1c49fc2e708d5291420f39771264e89d9328 (diff)
downloadgitlab-shell-46b92499f1778775e31a1c27cfd1013586cd9cdf.tar.gz
Merge pull request #212 from jirutka/patch-1
Allow to configure location of the secret file
-rw-r--r--config.yml.example4
-rw-r--r--lib/gitlab_config.rb4
-rw-r--r--lib/gitlab_net.rb2
3 files changed, 9 insertions, 1 deletions
diff --git a/config.yml.example b/config.yml.example
index 1173ad0..9dc30db 100644
--- a/config.yml.example
+++ b/config.yml.example
@@ -25,6 +25,10 @@ repos_path: "/home/git/repositories"
# File used as authorized_keys for gitlab user
auth_file: "/home/git/.ssh/authorized_keys"
+# File that contains the secret key for verifying access to GitLab.
+# Default is .gitlab_shell_secret in the root directory.
+# secret_file: "/home/git/gitlab-shell/.gitlab_shell_secret"
+
# Redis settings used for pushing commit notices to gitlab
redis:
bin: /usr/bin/redis-cli
diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb
index 300d6ba..caca176 100644
--- a/lib/gitlab_config.rb
+++ b/lib/gitlab_config.rb
@@ -19,6 +19,10 @@ class GitlabConfig
@config['auth_file'] ||= File.join(home, ".ssh/authorized_keys")
end
+ def secret_file
+ @config['secret_file'] ||= File.join(ROOT_PATH, '.gitlab_shell_secret')
+ end
+
def gitlab_url
@config['gitlab_url'] ||= "http://localhost/"
end
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index d5bda88..8eb63ae 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -137,6 +137,6 @@ class GitlabNet
end
def secret_token
- @secret_token ||= File.read File.join(ROOT_PATH, '.gitlab_shell_secret')
+ @secret_token ||= File.read config.secret_file
end
end