Documentation ¶
Overview ¶
Package modconfig provides access to the standard CUE module configuration, including registry access and authorization.
Index ¶
Constants ¶
const DefaultRegistry = "registry.cue.works"
DefaultRegistry is the default registry host.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Authorizer is used to authorize registry requests. // If it's nil, a default authorizer will be used that consults // the information stored by "cue login" and "docker login". Authorizer ociauth.Authorizer // Env provides environment variable values. If this is nil, // the current process's environment will be used. Env []string }
Config provides the starting point for the configuration.
type HostLocation ¶
type HostLocation = modresolve.Location
HostLocation represents a registry host and a location with it.
type Registry ¶
type Registry interface { // Requirements returns a list of the modules required by the given module // version. Requirements(ctx context.Context, m module.Version) ([]module.Version, error) // Fetch returns the location of the contents for the given module // version, downloading it if necessary. Fetch(ctx context.Context, m module.Version) (module.SourceLoc, error) // ModuleVersions returns all the versions for the module with the // given path, which should contain a major version. ModuleVersions(ctx context.Context, mpath string) ([]string, error) }
Registry is used to access CUE modules from external sources.
func NewRegistry ¶
NewRegistry returns an implementation of the Registry interface suitable for passing to [load.Instances]. It uses the standard CUE cache directory.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver implements modregistry.Resolver in terms of the CUE registry configuration file and auth configuration.
func NewResolver ¶
NewResolver returns an implementation of modregistry.Resolver that uses cfg to guide registry resolution. If cfg is nil, it's equivalent to passing pointer to a zero Config struct.
It consults the same environment variables used by the cue command.
The contents of the configuration will not be mutated.
func (*Resolver) AllHosts ¶
AllHosts returns information on all the registry host names referred to by the resolver.
func (*Resolver) ResolveToLocation ¶
func (r *Resolver) ResolveToLocation(mpath string, version string) (HostLocation, bool)
ResolveToLocation returns the host location for the given module path and version without creating a Registry instance for it.
func (*Resolver) ResolveToRegistry ¶
func (r *Resolver) ResolveToRegistry(mpath string, version string) (modregistry.RegistryLocation, error)
Resolve implements modregistry.Resolver.Resolve.