Documentation
¶
Overview ¶
Package conf provides configuration management for ace-dt and ace-dt library consumers. The package allows loading and access of configuration details, including registry configuration. Configuration details are validated against the current configuration scheme.
Index ¶
- type ConfigOverrideFunction
- type Configuration
- func (cfg *Configuration) AddConfigFiles(files []string)
- func (cfg *Configuration) AddConfigOverride(overrideFunction ...ConfigOverrideFunction)
- func (cfg *Configuration) CredStore() credentials.Store
- func (cfg *Configuration) Get(ctx context.Context) *v1alpha1.Configuration
- func (cfg *Configuration) GetConfigScheme() *runtime.Scheme
- func (cfg *Configuration) GraphTarget(ctx context.Context, ref string) (oras.GraphTarget, error)
- func (cfg *Configuration) NewRegistry(ctx context.Context, reg string) (*remote.Registry, error)
- func (cfg *Configuration) ParseEndpointReference(reference string) (registry.Reference, error)
- func (cfg *Configuration) ReadOnlyGraphTarget(ctx context.Context, ref string) (oras.ReadOnlyGraphTarget, error)
- func (cfg *Configuration) Repository(ctx context.Context, ref string) (*remote.Repository, error)
- func (cfg *Configuration) UserAgent() string
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigOverrideFunction ¶
type ConfigOverrideFunction func(ctx context.Context, c *v1alpha1.Configuration) error
ConfigOverrideFunction defines a function used to override config values after loading.
func WithCachePath ¶
func WithCachePath(path string) ConfigOverrideFunction
WithCachePath overwrites the loaded blob cache path.
func WithConcurrency ¶
func WithConcurrency(conc int) ConfigOverrideFunction
WithConcurrency overwrites the loaded concurrency configuration.
func WithRegistryConfig ¶
func WithRegistryConfig(regCfg v1alpha1.RegistryConfig) ConfigOverrideFunction
WithRegistryConfig overwrites the loaded registry configuration, appending new registry configurations if they do not already exist.
func WithTelemetry ¶
func WithTelemetry(hosts []telemv1alpha2.Location, userName string) ConfigOverrideFunction
WithTelemetry overwrites the telemetry username while appending telemetry hosts to the loaded telemetry configuration.
type Configuration ¶
type Configuration struct {
// ConfigFiles stores the search locations for the config file in ascending priority order. This field is exported
// in order to allow indirect setting through command line processing in cobra.
ConfigFiles []string
// contains filtered or unexported fields
}
Configuration stores and manages the ace-dt configuration file, based on the scheme and version defined in the apis. This data includes application settings, as well as telemetry and registry connection settings.
func New ¶
func New(credOpts ...Option) *Configuration
New returns a validated empty configuration object. Configuration files should be defined using AddConfigFiles. To initialize an empty default configuration, use New() followed by GetSafe().
func (*Configuration) AddConfigFiles ¶
func (cfg *Configuration) AddConfigFiles(files []string)
AddConfigFiles adds config files to the list of files parsed for configuration details.
func (*Configuration) AddConfigOverride ¶
func (cfg *Configuration) AddConfigOverride(overrideFunction ...ConfigOverrideFunction)
AddConfigOverride adds an overrideFunction that will be passed to config.Load to edit config.
func (*Configuration) CredStore ¶
func (cfg *Configuration) CredStore() credentials.Store
CredStore returns a docker credentials store.
func (*Configuration) Get ¶
func (cfg *Configuration) Get(ctx context.Context) *v1alpha1.Configuration
Get returns a configuration settings structure. The settings are loaded if they have not yet been loaded by a previous operation.
func (*Configuration) GetConfigScheme ¶
func (cfg *Configuration) GetConfigScheme() *runtime.Scheme
GetConfigScheme returns the runtime scheme used for configuration file loading.
func (*Configuration) GraphTarget ¶
func (cfg *Configuration) GraphTarget(ctx context.Context, ref string) (oras.GraphTarget, error)
GraphTarget sets up a repository target based on a reference string, making use of registry configuration settings. Implements GraphTargeter.
func (*Configuration) NewRegistry ¶
NewRegistry creates a ORAS registry using the registry configuration.
func (*Configuration) ParseEndpointReference ¶
func (cfg *Configuration) ParseEndpointReference(reference string) (registry.Reference, error)
ParseEndpointReference is the same as the oras registry.ParseReference, except that it resolves endpoints replacing the registry portion of the reference as defined by the configuration. Implements EndpointReferenceParser.
func (*Configuration) ReadOnlyGraphTarget ¶
func (cfg *Configuration) ReadOnlyGraphTarget(ctx context.Context, ref string) (oras.ReadOnlyGraphTarget, error)
ReadOnlyGraphTarget sets up a read-only repository target based on a reference string making use of registry configuration settings. Implements ReadOnlyGraphTargeter.
func (*Configuration) Repository ¶
func (cfg *Configuration) Repository(ctx context.Context, ref string) (*remote.Repository, error)
Repository sets up a repository target based on a reference string, making use of registry configuration settings. Since we return the Repository structure, it's troublesome to wrap the interface. In cases where alternative endpoints are used, it may be necessary to use an EndpointResolver.
func (*Configuration) UserAgent ¶
func (cfg *Configuration) UserAgent() string
UserAgent returns the configured userAgent string.
type Option ¶
type Option func(*Configuration)
Option provides additional optional configuration.
func WithCredentialStore ¶
func WithCredentialStore(store credentials.Store) Option
WithCredentialStore sets the credential store.
func WithUserAgent ¶
WithUserAgent overrides the default user-agent string used for http requests.