package modconfig
import "cuelang.org/go/mod/modconfig"
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.
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 }
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, vers 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, vers string) (modregistry.RegistryLocation, error)
Resolve implements modregistry.Resolver.Resolve.
Source Files ¶
modconfig.go
- Version
- v0.8.0-alpha.4
- Published
- Feb 29, 2024
- Platform
- windows/amd64
- Imports
- 17 packages
- Last checked
- 1 hour ago –
Tools for package owners.