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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user