summaryrefslogtreecommitdiff
path: root/lib/gitlab_config.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-12-09 12:52:26 +0000
committerSean McGivern <sean@gitlab.com>2016-12-12 13:21:42 +0000
commitfbc213eabdbb76ec846357d980705f5d4f20ecc5 (patch)
treefbc84343e0aa947c2a30e2b1040253ba7fbd1852 /lib/gitlab_config.rb
parent8e370b37e16dc8eebeca264c6c351dc4a4fdab4a (diff)
downloadgitlab-shell-fbc213eabdbb76ec846357d980705f5d4f20ecc5.tar.gz
Make custom hooks dir configurable
Add a new configuration option, custom_hooks_dir. When this is set, we will look for global custom hooks in: <custom_hooks_dir>/{pre-receive,update,post-receive}.d/* When this is not set, default to <REPO_PATH>/hooks.
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