aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorMax Resnick <max@ofmax.li>2024-08-24 17:09:03 -0700
committerMax Resnick <max@ofmax.li>2024-08-24 17:09:03 -0700
commit71ba0cd9b988813da1b5c7101f8bf5918df0f795 (patch)
tree5fb2e195a24a91dcd5997d8f3dfa346b8e73c998 /internal
parent6889411b014b39a440b7cbe52b482b28415ed829 (diff)
downloadgo-git-server-71ba0cd9b988813da1b5c7101f8bf5918df0f795.tar.gz
chore: add env var for log level, fix bug, cleanup push target
Diffstat (limited to 'internal')
-rw-r--r--internal/admin/service.go1
-rw-r--r--internal/authz/middleware.go2
2 files changed, 3 insertions, 0 deletions
diff --git a/internal/admin/service.go b/internal/admin/service.go
index 4f955da..d60a072 100644
--- a/internal/admin/service.go
+++ b/internal/admin/service.go
@@ -65,6 +65,7 @@ func (s *Servicer) InitServer() error {
return fmt.Errorf("cloudn't load policy %w", err)
}
slog.Info("policy loaded")
+ slog.Debug("init server", "repoDir", s.reposDir)
if err := s.Conf.ConfigureRepos(); err != nil {
return fmt.Errorf("couldn't configure repos %w", err)
}
diff --git a/internal/authz/middleware.go b/internal/authz/middleware.go
index 3ba95ad..31f7bf3 100644
--- a/internal/authz/middleware.go
+++ b/internal/authz/middleware.go
@@ -27,6 +27,7 @@ func Authentication(authMap TokenMap, next http.Handler) http.Handler {
u = "anon"
ctx := context.WithValue(req.Context(), AuthzUrnKey, u)
next.ServeHTTP(rw, req.WithContext(ctx))
+ return
}
urn := fmt.Sprintf("uid:%s", u)
hash, ok := authMap[urn]
@@ -76,6 +77,7 @@ func Authorization(adminSvc *admin.Servicer, next http.Handler) http.Handler {
slog.Info("Not Authorized", "urn", urn, "repo", repo)
http.Error(rw, "Access denied", http.StatusForbidden)
return
+
}
slog.Debug("Access Attempt", "action", action, "repo", repo)
next.ServeHTTP(rw, req.WithContext(ctx))