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
NewHandler is similar to New except that it just returns the HTTP handler for the server instead of actually starting a server.
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.