diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-17 12:26:55 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-18 11:26:12 +0300 |
commit | db993a6b1bdf129a02fdb5c6dfcef1f68d567644 (patch) | |
tree | 0242998757125546b3e931ccf87c09c8743b82d6 | |
parent | 27a6f6c88abf6ae2dc5cb18cab613e1869b2a0af (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 ee61b5b14..ae9ec3cff 100644 --- a/internal/gitaly/config/config.go +++ b/internal/gitaly/config/config.go @@ -261,12 +261,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)) } |