s
This commit is contained in:
+12
-11
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user