feat: add terraform-local package type for local registry

- New package type "terraform-local" for hosting terraform providers
  without an upstream registry
- Upload via PUT /api/v2/remotes/{name}/files/{path}, returns 409 on
  duplicate (overwrites not allowed)
- Download via GET on same path, or via v1 proxy route
- Provider registers as fully immutable, no upstream rewriting
- v1 proxy handler serves local files directly for local repo types
- Database CRUD for local_files table
This commit is contained in:
2026-06-21 23:01:59 +10:00
parent b46c116f6b
commit 2f1e3830da
6 changed files with 328 additions and 7 deletions
+9 -1
View File
@@ -28,6 +28,7 @@ import (
_ "git.unkin.net/unkin/artifactapi/internal/provider/pypi"
_ "git.unkin.net/unkin/artifactapi/internal/provider/rpm"
_ "git.unkin.net/unkin/artifactapi/internal/provider/terraform"
_ "git.unkin.net/unkin/artifactapi/internal/provider/terraformlocal"
"git.unkin.net/unkin/artifactapi/internal/proxy"
"git.unkin.net/unkin/artifactapi/internal/storage"
"git.unkin.net/unkin/artifactapi/internal/virtual"
@@ -91,7 +92,7 @@ func (s *Server) routes() chi.Router {
r.Get("/health", s.handleHealth)
r.Get("/", s.handleRoot)
proxyHandler := v1.NewProxyHandler(s.engine, s.virtEngine, s.db)
proxyHandler := v1.NewProxyHandler(s.engine, s.virtEngine, s.db, s.store)
r.Mount("/api/v1", proxyHandler.Routes())
remotesHandler := v2.NewRemotesHandler(s.db)
@@ -114,6 +115,13 @@ func (s *Server) routes() chi.Router {
r.Get("/", objHandler.Routes().ServeHTTP)
r.Delete("/*", objHandler.Routes().ServeHTTP)
})
localHandler := v2.NewLocalHandler(s.db, s.store)
r.Route("/remotes/{name}/files", func(r chi.Router) {
r.Put("/*", localHandler.Routes().ServeHTTP)
r.Get("/*", localHandler.Routes().ServeHTTP)
r.Delete("/*", localHandler.Routes().ServeHTTP)
})
})
return r