summaryrefslogtreecommitdiff
path: root/lib/gitlab_config.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-12-12 15:09:20 +0000
committerRémy Coutable <remy@rymai.me>2016-12-12 15:09:20 +0000
commit92dad7c1855666cb0755ee1f9f6f1910c903fb92 (patch)
tree39ee847a871636e0f71e25ecaf6c50799de31df0 /lib/gitlab_config.rb
parent8e370b37e16dc8eebeca264c6c351dc4a4fdab4a (diff)
parentbf21f6eeef482c71a5ff2b3d26da048ac236b075 (diff)
downloadgitlab-shell-4.1.0.tar.gz
Merge branch 'make-custom-hook-dir-configurable' into 'master' v4.1.0
Make custom hook dir configurable Add a new configuration option, custom_hook_dir. When this is set, we will look for global custom hooks in: `<custom_hook_dir>/{pre-receive,update,post-receive}.d/*` When this is not set, default to `<ROOT_PATH>/hooks`. Relates to https://gitlab.com/gitlab-org/omnibus-gitlab/issues/1754 and gitlab-org/gitlab-ce!8040. See merge request !113
Diffstat (limited to 'lib/gitlab_config.rb')
-rw-r--r--lib/gitlab_config.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb
index f8a10cf..a51a32c 100644
--- a/lib/gitlab_config.rb
+++ b/lib/gitlab_config.rb
@@ -19,6 +19,13 @@ class GitlabConfig
@config['secret_file'] ||= File.join(ROOT_PATH, '.gitlab_shell_secret')
end
+ # Pass a default value because this is called from a repo's context; in which
+ # case, the repo's hooks directory should be the default.
+ #
+ def custom_hooks_dir(default: nil)
+ @config['custom_hooks_dir'] || default
+ end
+
def gitlab_url
(@config['gitlab_url'] ||= "http://localhost:8080").sub(%r{/*$}, '')
end