diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-17 12:26:55 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-21 17:50:51 +0300 |
commit | 82f34c7f355d69a507f83993580676b7c21ff147 (patch) | |
tree | 8ca7479bab57db05898cca1e7c1d24692b563974 | |
parent | 7a8b33aa729e0b7ed58be125407808edc08dff1e (diff) |
gitaly/config: Migrate internal sockets to use runtime directory
Migrate the default location of internal sockets to be created in the
runtime directory.
Changelog: changed
-rw-r--r-- | internal/gitaly/config/config.go | 8 | ||||
-rw-r--r-- | internal/testhelper/testcfg/gitaly_builder.go | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/internal/gitaly/config/config.go b/internal/gitaly/config/config.go index 9ff270c8c..3f6757db3 100644 --- a/internal/gitaly/config/config.go +++ b/internal/gitaly/config/config.go @@ -260,12 +260,12 @@ func (cfg *Cfg) setDefaults() error { // socket paths. We hope/expect that os.MkdirTemp creates a directory // that is not too deep. We need a directory, not a tempfile, because we // will later want to set its permissions to 0700 - - tmpDir, err := os.MkdirTemp("", "gitaly-internal") - if err != nil { + socketDir := filepath.Join(cfg.RuntimeDir, "sock.d") + if err := os.Mkdir(socketDir, 0o700); err != nil { return fmt.Errorf("create internal socket directory: %w", err) } - cfg.InternalSocketDir = tmpDir + + cfg.InternalSocketDir = socketDir } if reflect.DeepEqual(cfg.DailyMaintenance, DailyJob{}) { diff --git a/internal/testhelper/testcfg/gitaly_builder.go b/internal/testhelper/testcfg/gitaly_builder.go index f89f0edc6..855bbe549 100644 --- a/internal/testhelper/testcfg/gitaly_builder.go +++ b/internal/testhelper/testcfg/gitaly_builder.go @@ -112,7 +112,7 @@ func (gc *GitalyCfgBuilder) Build(t testing.TB) config.Cfg { } if cfg.InternalSocketDir == "" { - cfg.InternalSocketDir = filepath.Join(root, "internal_socks.d") + cfg.InternalSocketDir = filepath.Join(cfg.RuntimeDir, "sock.d") require.NoError(t, os.Mkdir(cfg.InternalSocketDir, 0o755)) } |