registrytest

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 added in v0.8.0

func NewHandler(fsys fs.FS, prefix string) (http.Handler, error)

NewHandler is similar to New except that it just returns the HTTP handler for the server instead of actually starting a server.

func Upload added in v0.8.0

func Upload(ctx context.Context, r ociregistry.Interface, fsys fs.FS) error

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL