Merge branch '10346-rearrange-api-docs' closes #10346
[arvados.git] / services / arv-git-httpd / auth_handler.go
index 6ba0f387986111c805c3a631dc5666e16f75013b..9f92cd1b7213f5a720a771ae349fac7dd6558b39 100644 (file)
@@ -20,8 +20,12 @@ type authHandler struct {
 }
 
 func (h *authHandler) setup() {
-       os.Setenv("ARVADOS_API_HOST", theConfig.Client.APIHost)
-       h.clientPool = arvadosclient.MakeClientPool()
+       ac, err := arvadosclient.New(&theConfig.Client)
+       if err != nil {
+               log.Fatal(err)
+       }
+       h.clientPool = &arvadosclient.ClientPool{Prototype: ac}
+       log.Printf("%+v", h.clientPool.Prototype)
 }
 
 func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
@@ -137,7 +141,7 @@ func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
                "/" + repoName + "/.git",
        }
        for _, dir := range tryDirs {
-               if fileInfo, err := os.Stat(theConfig.Root + dir); err != nil {
+               if fileInfo, err := os.Stat(theConfig.RepoRoot + dir); err != nil {
                        if !os.IsNotExist(err) {
                                statusCode, statusText = http.StatusInternalServerError, err.Error()
                                return
@@ -149,7 +153,7 @@ func (h *authHandler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
        }
        if rewrittenPath == "" {
                log.Println("WARNING:", repoUUID,
-                       "git directory not found in", theConfig.Root, tryDirs)
+                       "git directory not found in", theConfig.RepoRoot, tryDirs)
                // We say "content not found" to disambiguate from the
                // earlier "API says that repo does not exist" error.
                statusCode, statusText = http.StatusNotFound, "content not found"