Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CurrentVersion = MajorMinorVersion(0, 1)
CurrentVersion is the most recent Version that can be parsed
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth map[string]Parameters
Auth defines the configuration for registry authorization.
func (Auth) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface
func (Auth) Parameters ¶
func (auth Auth) Parameters() Parameters
Parameters returns the Parameters map for an Auth configuration
func (*Auth) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface Unmarshals a single item map into a Storage or a string into a Storage type with no parameters
type BugsnagReporting ¶
type BugsnagReporting struct {
// APIKey is the Bugsnag api key.
APIKey string `yaml:"apikey,omitempty"`
// ReleaseStage tracks where the registry is deployed.
// Examples: production, staging, development
ReleaseStage string `yaml:"releasestage,omitempty"`
// Endpoint is used for specifying an enterprise Bugsnag endpoint.
Endpoint string `yaml:"endpoint,omitempty"`
}
BugsnagReporting configures error reporting for Bugsnag (bugsnag.com).
type Configuration ¶
type Configuration struct {
// Version is the version which defines the format of the rest of the configuration
Version Version `yaml:"version"`
// Loglevel is the level at which registry operations are logged
Loglevel Loglevel `yaml:"loglevel"`
// Storage is the configuration for the registry's storage driver
Storage Storage `yaml:"storage"`
// Auth allows configuration of various authorization methods that may be
// used to gate requests.
Auth Auth `yaml:"auth,omitempty"`
// LayerHandler specifies a middleware for serving image layers.
LayerHandler LayerHandler `yaml:"layerhandler,omitempty"`
// Reporting is the configuration for error reporting
Reporting Reporting `yaml:"reporting,omitempty"`
// HTTP contains configuration parameters for the registry's http
// interface.
HTTP struct {
// Addr specifies the bind address for the registry instance.
Addr string `yaml:"addr,omitempty"`
Prefix string `yaml:"prefix,omitempty"`
// Secret specifies the secret key which HMAC tokens are created with.
Secret string `yaml:"secret,omitempty"`
// TLS instructs the http server to listen with a TLS configuration.
// This only support simple tls configuration with a cert and key.
// Mostly, this is useful for testing situations or simple deployments
// that require tls. If more complex configurations are required, use
// a proxy or make a proposal to add support here.
TLS struct {
// Certificate specifies the path to an x509 certificate file to
// be used for TLS.
Certificate string `yaml:"certificate,omitempty"`
// Key specifies the path to the x509 key file, which should
// contain the private portion for the file specified in
// Certificate.
Key string `yaml:"key,omitempty"`
} `yaml:"tls,omitempty"`
// Debug configures the http debug interface, if specified. This can
// include services such as pprof, expvar and other data that should
// not be exposed externally. Left disabled by default.
Debug struct {
// Addr specifies the bind address for the debug server.
Addr string `yaml:"addr,omitempty"`
} `yaml:"debug,omitempty"`
} `yaml:"http,omitempty"`
// Notifications specifies configuration about various endpoint to which
// registry events are dispatched.
Notifications Notifications `yaml:"notifications,omitempty"`
}
Configuration is a versioned registry configuration, intended to be provided by a yaml file, and optionally modified by environment variables
func Parse ¶
func Parse(rd io.Reader) (*Configuration, error)
Parse parses an input configuration yaml document into a Configuration struct This should generally be capable of handling old configuration format versions
Environment variables may be used to override configuration parameters other than version, following the scheme below: Configuration.Abc may be replaced by the value of REGISTRY_ABC, Configuration.Abc.Xyz may be replaced by the value of REGISTRY_ABC_XYZ, and so forth
type Endpoint ¶
type Endpoint struct {
Name string `yaml:"name"` // identifies the endpoint in the registry instance.
Disabled bool `yaml:"disabled"` // disables the endpoint
URL string `yaml:"url"` // post url for the endpoint.
Headers http.Header `yaml:"headers"` // static headers that should be added to all requests
Timeout time.Duration `yaml:"timeout"` // HTTP timeout
Threshold int `yaml:"threshold"` // circuit breaker threshold before backing off on failure
Backoff time.Duration `yaml:"backoff"` // backoff duration
}
Endpoint describes the configuration of an http webhook notification endpoint.
type LayerHandler ¶
type LayerHandler map[string]Parameters
LayerHandler defines the configuration for middleware layer serving
func (LayerHandler) MarshalYAML ¶
func (layerHandler LayerHandler) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface
func (LayerHandler) Parameters ¶
func (layerHandler LayerHandler) Parameters() Parameters
Parameters returns the Parameters map for a LayerHandler configuration
func (LayerHandler) Type ¶
func (layerHandler LayerHandler) Type() string
Type returns the layerhandler type
func (*LayerHandler) UnmarshalYAML ¶
func (layerHandler *LayerHandler) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface Unmarshals a single item map into a Storage or a string into a Storage type with no parameters
type Loglevel ¶
type Loglevel string
Loglevel is the level at which operations are logged This can be error, warn, info, or debug
func (*Loglevel) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Umarshaler interface Unmarshals a string into a Loglevel, lowercasing the string and validating that it represents a valid loglevel
type NewRelicReporting ¶
type NewRelicReporting struct {
// LicenseKey is the NewRelic user license key
LicenseKey string `yaml:"licensekey,omitempty"`
// Name is the component name of the registry in NewRelic
Name string `yaml:"name,omitempty"`
}
NewRelicReporting configures error reporting for NewRelic (newrelic.com)
type Notifications ¶
type Notifications struct {
// Endpoints is a list of http configurations for endpoints that
// respond to webhook notifications. In the future, we may allow other
// kinds of endpoints, such as external queues.
Endpoints []Endpoint `yaml:"endpoints,omitempty"`
}
Notifications configures multiple http endpoints.
type Parameters ¶
type Parameters map[string]interface{}
Parameters defines a key-value parameters mapping
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser can be used to parse a configuration file and environment of a defined version into a unified output structure
func NewParser ¶
func NewParser(prefix string, parseInfos []VersionedParseInfo) *Parser
NewParser returns a *Parser with the given environment prefix which handles versioned configurations which match the given parseInfos
func (*Parser) Parse ¶
Parse reads in the given []byte and environment and writes the resulting configuration into the input v
Environment variables may be used to override configuration parameters other than version, following the scheme below: v.Abc may be replaced by the value of PREFIX_ABC, v.Abc.Xyz may be replaced by the value of PREFIX_ABC_XYZ, and so forth
type Reporting ¶
type Reporting struct {
// Bugsnag configures error reporting for Bugsnag (bugsnag.com).
Bugsnag BugsnagReporting `yaml:"bugsnag,omitempty"`
// NewRelic configures error reporting for NewRelic (newrelic.com)
NewRelic NewRelicReporting `yaml:"newrelic,omitempty"`
}
Reporting defines error reporting methods.
type Storage ¶
type Storage map[string]Parameters
Storage defines the configuration for registry object storage
func (Storage) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface
func (Storage) Parameters ¶
func (storage Storage) Parameters() Parameters
Parameters returns the Parameters map for a Storage configuration
func (*Storage) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface Unmarshals a single item map into a Storage or a string into a Storage type with no parameters
type Version ¶
type Version string
Version is a major/minor version pair of the form Major.Minor Major version upgrades indicate structure or type changes Minor version upgrades should be strictly additive
func MajorMinorVersion ¶
MajorMinorVersion constructs a Version from its Major and Minor components
func (*Version) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface Unmarshals a string of the form X.Y into a Version, validating that X and Y can represent uints
type VersionedParseInfo ¶
type VersionedParseInfo struct {
// Version is the version which this parsing information relates to
Version Version
// ParseAs defines the type which a configuration file of this version
// should be parsed into
ParseAs reflect.Type
// ConversionFunc defines a method for converting the parsed configuration
// (of type ParseAs) into the current configuration version
// Note: this method signature is very unclear with the absence of generics
ConversionFunc func(interface{}) (interface{}, error)
}
VersionedParseInfo defines how a specific version of a configuration should be parsed into the current version