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

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Okstad <pokstad@gitlab.com>2020-05-20 07:15:11 +0300
committerPaul Okstad <pokstad@gitlab.com>2020-05-20 07:15:11 +0300
commit4cd8d0c5614cafc3ca41f3473004adaeabc77e24 (patch)
tree6b05a76921d1126ae47fd8262003b6c17f001e8e
parent382ead9c7ef38e7dde4de7a9d2eba37a739060be (diff)
parent3c932b7898cb7e4bd192d02e7234aae5bde397f1 (diff)
Merge branch 'jc-set-default-custom-hooks-dir' into 'master'
Set default value for custom hooks directory See merge request gitlab-org/gitaly!2184
-rw-r--r--internal/config/config.go4
-rw-r--r--internal/config/config_test.go15
2 files changed, 19 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 327ff0e93..0b31aaf00 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -167,6 +167,10 @@ func (c *Cfg) setDefaults() {
if c.GitlabShell.SecretFile == "" {
c.GitlabShell.SecretFile = filepath.Join(c.GitlabShell.Dir, ".gitlab_shell_secret")
}
+
+ if c.GitlabShell.CustomHooksDir == "" {
+ c.GitlabShell.CustomHooksDir = filepath.Join(c.GitlabShell.Dir, "hooks")
+ }
}
func validateListeners() error {
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index cacde0033..82b916796 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -646,6 +646,21 @@ func TestLoadGracefulRestartTimeout(t *testing.T) {
}
}
+func TestGitlabShellDefaults(t *testing.T) {
+ expectedDefault := GitlabShell{
+ Dir: "/dir",
+ SecretFile: "/dir/.gitlab_shell_secret",
+ CustomHooksDir: "/dir/hooks",
+ }
+
+ tmpFile := configFileReader(fmt.Sprintf(`[gitlab-shell]
+dir = '%s'`, expectedDefault.Dir))
+ require.NoError(t, Load(tmpFile))
+
+ require.Equal(t, expectedDefault.SecretFile, Config.GitlabShell.SecretFile)
+ require.Equal(t, expectedDefault.CustomHooksDir, Config.GitlabShell.CustomHooksDir)
+}
+
func TestValidateInternalSocketDir(t *testing.T) {
defer func(internalSocketDir string) {
Config.InternalSocketDir = internalSocketDir