This commit is contained in:
Jabberwocky238
2026-07-16 09:14:16 -04:00
parent c64116069e
commit a289f1b911
4 changed files with 55 additions and 41 deletions
+12 -11
View File
@@ -21,20 +21,21 @@ import (
)
type Server struct {
gitRepoRoot string
cfg *common.Config
startedAt time.Time
middleware *MiddlewareClient
mut state.IStateMut
cfg *common.Config
startedAt time.Time
middleware *MiddlewareClient
mut state.IStateMut
}
func NewServer(cfg *common.Config, middleware *MiddlewareClient, mut state.IStateMut) *Server {
if err := cfg.Prepare(); err != nil {
return nil
}
return &Server{
gitRepoRoot: cfg.Root,
cfg: cfg,
startedAt: time.Now(),
middleware: middleware,
mut: mut,
cfg: cfg,
startedAt: time.Now(),
middleware: middleware,
mut: mut,
}
}
@@ -168,7 +169,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
func (s *Server) open(ctx context.Context, repo string) (*gitcmd.Repository, error) {
p, err := common.Resolve(s.gitRepoRoot, repo)
p, err := common.Resolve(s.cfg.RepoRoot(), repo)
if err != nil {
return nil, newError(codeInvalidParams, "invalid repo name: "+err.Error())
}