Documentation
¶
Overview ¶
Package config defines strata's configuration file, strata.yaml.
Precedence is flag, then environment (STRATA_ prefix, dots and dashes become underscores), then file, then the defaults here.
Index ¶
Constants ¶
const ( ProviderAuto = "auto" ProviderECR = "ecr" ProviderHarbor = "harbor" ProviderGAR = "gar" ProviderACR = "acr" ProviderDistribution = "distribution" )
Providers.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// DB is the index file.
DB string `mapstructure:"db"`
Registries []Registry `mapstructure:"registries"`
// External bases fetched so roots resolve, such as
// docker.io/library/debian:bookworm-slim.
External []string `mapstructure:"external"`
// Referrers fetches SBOMs, signatures and attestations.
Referrers bool `mapstructure:"referrers"`
// Provenance reads the BuildKit provenance attached to images, which
// names the bases they were built from.
Provenance bool `mapstructure:"provenance"`
// FetchBases fetches, by digest, bases provenance names that are not
// indexed, from whatever registry they are in.
FetchBases bool `mapstructure:"fetch-bases"`
// Platform is the default when a ref names a multi-platform index.
Platform string `mapstructure:"platform"`
// LineageLabels are label keys naming an image's base.
LineageLabels []string `mapstructure:"lineage-labels"`
// PolicyFile is a staleness policy YAML file.
PolicyFile string `mapstructure:"policy"`
// Required label keys; missing:<key> queries and compliance use them.
Required []string `mapstructure:"required"`
// Synonyms map label keys that mean the same, such as owner: team.
Synonyms map[string]string `mapstructure:"synonyms"`
// EnvAllowlist names environment variables whose values are stored.
EnvAllowlist []string `mapstructure:"env-allowlist"`
// Redactions are extra regular expressions scrubbed from history.
Redactions []string `mapstructure:"redactions"`
Serve Serve `mapstructure:"serve"`
LogLevel string `mapstructure:"log-level"`
}
Config is the whole configuration.
type Registry ¶
type Registry struct {
// Host is the registry host, such as reg.io.
Host string `mapstructure:"host"`
// Repos seeds the repo list for registries whose catalog endpoint is
// missing or too slow. Empty means use the catalog.
Repos []string `mapstructure:"repos"`
// Insecure allows plain HTTP.
Insecure bool `mapstructure:"insecure"`
// Workers bounds concurrent requests.
Workers int `mapstructure:"workers"`
// Rate is the request limit per second; 0 means unlimited.
Rate float64 `mapstructure:"rate"`
// Provider picks how the registry is listed: auto (the default) uses
// the ECR, Artifact Registry or ACR API for those hosts; ecr, harbor,
// gar and acr force one; distribution uses the plain distribution API.
Provider string `mapstructure:"provider"`
// AWSProfile, AssumeRole and ExternalID pick the AWS identity for an
// ECR registry, so registries in different accounts can each use
// their own credentials. Unset, the default AWS credential chain is
// used.
AWSProfile string `mapstructure:"aws-profile"`
AssumeRole string `mapstructure:"assume-role"`
ExternalID string `mapstructure:"external-id"`
// Projects are the Google Cloud projects whose Artifact Registry
// repositories are listed (gar only).
Projects []string `mapstructure:"projects"`
// IncludeRepos and ExcludeRepos are repo globs, named without the
// host: "*" stays within a path segment and "**" crosses them.
IncludeRepos []string `mapstructure:"include-repos"`
ExcludeRepos []string `mapstructure:"exclude-repos"`
// IncludeTags and ExcludeTags are tag globs, such as v* or pr-*.
IncludeTags []string `mapstructure:"include-tags"`
ExcludeTags []string `mapstructure:"exclude-tags"`
// Platforms keeps only these platforms of multi-platform images, such
// as linux/amd64.
Platforms []string `mapstructure:"platforms"`
// PushedSince skips images pushed longer ago than this, such as 90d or
// 1y. It needs the ECR API.
PushedSince string `mapstructure:"pushed-since"`
}
Registry is one registry to crawl.
func (Registry) Kind ¶ added in v0.3.0
Kind returns the provider the registry is listed with, resolving auto from the host: ECR, Artifact Registry and ACR hosts are recognized; Harbor has to be named.
func (Registry) ReportsPushes ¶ added in v0.3.0
ReportsPushes reports whether the registry's API reports push times.
type Serve ¶
type Serve struct {
// Addr is the listen address. Anything but loopback is shared mode,
// which refuses to start without auth.
Addr string `mapstructure:"addr"`
// AuthHeader is a header set by a trusted auth proxy, such as
// X-Forwarded-User. Requests without it are rejected.
AuthHeader string `mapstructure:"auth-header"`
// URL is where a running server is reached; CLI commands route through
// it when the index file is locked by the server.
URL string `mapstructure:"url"`
}
Serve configures strata serve.