gocuelang.org/go/internal/registrytest Index | Files

package registrytest

import "cuelang.org/go/internal/registrytest"

Index

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.

Types

type AuthConfig

type AuthConfig struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

AuthConfig specifies authorization requirements for the server. Currently it only supports basic auth.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func New

func New(fsys fs.FS, prefix string) (*Registry, error)

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

func (r *Registry) Host() string

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.7.0-rc.1
Published
Dec 4, 2023
Platform
darwin/amd64
Imports
24 packages
Last checked
1 hour ago

Tools for package owners.