config

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	ProviderAuto         = "auto"
	ProviderECR          = "ecr"
	ProviderHarbor       = "harbor"
	ProviderGAR          = "gar"
	ProviderACR          = "acr"
	ProviderDistribution = "distribution"
)

Providers.

Variables

This section is empty.

Functions

func DefaultDB

func DefaultDB() string

DefaultDB returns the default index path: $XDG_DATA_HOME/strata/strata.duckdb, or ~/.local/share/strata.

func Defaults

func Defaults() map[string]any

Defaults returns the configuration used when nothing is set.

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.

func (*Config) Policy

func (c *Config) Policy() (stale.Policy, error)

Policy loads the staleness policy the config names, or the defaults.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks values that would otherwise fail late.

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) Check added in v0.2.0

func (r Registry) Check() error

Check reports settings that would fail the crawl.

func (Registry) Filter added in v0.2.0

func (r Registry) Filter() (crawl.Filter, error)

Filter returns the registry's crawl filter.

func (Registry) Kind added in v0.3.0

func (r Registry) Kind() string

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

func (r Registry) ReportsPushes() bool

ReportsPushes reports whether the registry's API reports push times.

func (Registry) UsesECR added in v0.2.0

func (r Registry) UsesECR() bool

UsesECR reports whether the registry is listed through the ECR API.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL