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"`
// ReleaseStage tracks where the registry is deployed.
// Examples: production, staging, development
ReleaseStage string `yaml:"releasestage"`
// Endpoint is used for specifying an enterprise Bugsnag endpoint.
Endpoint string `yaml:"endpoint"`
}
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"`
// LayerHandler specifies a middleware for serving image layers.
LayerHandler LayerHandler `yaml:"layerhandler"`
// Reporting is the configuration for error reporting
Reporting Reporting `yaml:"reporting"`
// 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"`
// Secret specifies the secret key which HMAC tokens are created with.
Secret string `yaml:"secret"`
} `yaml:"http"`
}
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 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"`
// Name is the component name of the registry in NewRelic
Name string `yaml:"name"`
}
NewRelicReporting configures error reporting for NewRelic (newrelic.com)
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"`
// NewRelic configures error reporting for NewRelic (newrelic.com)
NewRelic NewRelicReporting `yaml:"newrelic"`
}
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