package registrytest
import "cuelang.org/go/internal/registrytest"
Index ¶
- func AuthHandler(handler http.Handler, cfg *AuthConfig) http.Handler
- func NewHandler(fsys fs.FS, prefix string) (http.Handler, error)
- func Upload(ctx context.Context, r ociregistry.Interface, fsys fs.FS) error
- type AuthConfig
- type Registry
Functions ¶
func AuthHandler ¶
func AuthHandler(handler http.Handler, cfg *AuthConfig) http.Handler
AuthHandler wraps the given handler with logic that checks that the incoming requests fulfil the auth requirements defined in cfg. If cfg is nil or there are no auth requirements, it returns handler unchanged.
func NewHandler ¶
NewHandler is similar to New except that it just returns the HTTP handler for the server instead of actually starting a server.
func Upload ¶
Upload uploads the modules found inside fsys (stored in the format described by New) to the given registry.
Types ¶
type AuthConfig ¶
type AuthConfig struct { Username string `json:"username"` Password string `json:"password"` BearerToken string `json:"bearerToken"` }
AuthConfig specifies authorization requirements for the server. Currently it only supports basic and bearer auth.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func New ¶
New starts a registry instance that serves modules found inside fsys. It serves the OCI registry protocol. If prefix is non-empty, all module paths will be prefixed by that, separated by a slash (/).
Each module should be inside a directory named path_vers, where slashes in path have been replaced with underscores and should contain a cue.mod/module.cue file holding the module info.
If there's a file named auth.json in the root directory, it will cause access to the server to be gated by the specified authorization. See the AuthConfig type for details.
The Registry should be closed after use.
func (*Registry) Close ¶
func (r *Registry) Close()
func (*Registry) Host ¶
Host returns the hostname for the registry server; for example localhost:13455.
The connection can be assumed to be insecure.
Source Files ¶
fileio.go registry.go
- Version
- v0.8.0-rc.1
- Published
- Mar 13, 2024
- Platform
- js/wasm
- Imports
- 25 packages
- Last checked
- 54 minutes ago –
Tools for package owners.