Files
zot/pkg/extensions/config/sync/config.go
T
Vishwas Rajashekar 14cd52e993 feat(sync): move stream from global to per upstream
Signed-off-by: Vishwas Rajashekar <dev@vrajashkr.com>
2026-05-22 17:40:26 +05:30

67 lines
1.9 KiB
Go

package sync
import (
"time"
)
// CredentialsFile is a map where key is registry address.
type CredentialsFile map[string]Credentials
type Credentials struct {
Username string
Password string
}
type Config struct {
Enable *bool
CredentialsFile string
/* DownloadDir is needed only in case of using cloud based storages
it uses regclient to first copy images into this dir (as oci layout)
and then move them into storage. */
DownloadDir string
Registries []RegistryConfig
}
type RegistryConfig struct {
URLs []string
PollInterval time.Duration
Content []Content
TLSVerify *bool
OnDemand bool
// Stream is set to true when it is desired to stream blobs to clients as they are being synced from this upstream.
Stream *bool
CertDir string
MaxRetries *int
RetryDelay *time.Duration
OnlySigned *bool
SyncLegacyCosignTags *bool // when unset, defaults to true
CredentialHelper string
PreserveDigest bool // sync without converting
SyncTimeout time.Duration // overall HTTP client timeout for all sync operations
ResponseHeaderTimeout time.Duration `yaml:"-"` // response header timeout; set in root.go
}
// ShouldSyncLegacyCosignTags returns whether to sync legacy cosign tags (e.g. sha256-<digest>.sig/sbom).
// Default is true when SyncLegacyCosignTags is unset (nil).
func (r RegistryConfig) ShouldSyncLegacyCosignTags() bool {
return r.SyncLegacyCosignTags == nil || *r.SyncLegacyCosignTags
}
// IsStreamEnabled returns true if streaming is enabled for this registry config.
func (r RegistryConfig) IsStreamEnabled() bool {
return r.Stream != nil && *r.Stream
}
type Content struct {
Prefix string
Tags *Tags
Destination string `mapstructure:",omitempty"`
StripPrefix bool
}
type Tags struct {
Regex *string
ExcludeRegex *string
Semver *bool
}