From 71ab9b7f14118f02dd18cd733bd4e0ad19ece590 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 5 Apr 2025 20:21:32 +0800 Subject: config shall no longer be a global variable --- ssh_handle_receive_pack.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ssh_handle_receive_pack.go') diff --git a/ssh_handle_receive_pack.go b/ssh_handle_receive_pack.go index f8777fa..ed7ef40 100644 --- a/ssh_handle_receive_pack.go +++ b/ssh_handle_receive_pack.go @@ -34,8 +34,8 @@ type packPass struct { var packPasses = cmap.Map[string, packPass]{} // sshHandleRecvPack handles attempts to push to repos. -func sshHandleRecvPack(session gliderSSH.Session, pubkey, repoIdentifier string) (err error) { - groupPath, repoName, repoID, repoPath, directAccess, contribReq, userType, userID, err := getRepoInfo2(session.Context(), repoIdentifier, pubkey) +func (s *server) sshHandleRecvPack(session gliderSSH.Session, pubkey, repoIdentifier string) (err error) { + groupPath, repoName, repoID, repoPath, directAccess, contribReq, userType, userID, err := s.getRepoInfo2(session.Context(), repoIdentifier, pubkey) if err != nil { return err } @@ -55,7 +55,7 @@ func sshHandleRecvPack(session gliderSSH.Session, pubkey, repoIdentifier string) } hooksPath := repoConfCore.OptionAll("hooksPath") - if len(hooksPath) != 1 || hooksPath[0] != config.Hooks.Execs { + if len(hooksPath) != 1 || hooksPath[0] != s.config.Hooks.Execs { return errors.New("repository has hooksPath set to an unexpected value") } @@ -114,7 +114,7 @@ func sshHandleRecvPack(session gliderSSH.Session, pubkey, repoIdentifier string) proc := exec.CommandContext(session.Context(), "git-receive-pack", repoPath) proc.Env = append(os.Environ(), - "LINDENII_FORGE_HOOKS_SOCKET_PATH="+config.Hooks.Socket, + "LINDENII_FORGE_HOOKS_SOCKET_PATH="+s.config.Hooks.Socket, "LINDENII_FORGE_HOOKS_COOKIE="+cookie, ) proc.Stdin = session -- cgit v1.2.3