config

package
v0.89.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBothSecretsSet    = errors.New("both secrets are set, please use one or the other")
	ErrBothSecretsNotSet = errors.New("neither secrets are set, please use one or the other")
	ErrInvalidHttpUrl    = errors.New("invalid HTTP URL")
	ErrInvalidGitUrl     = errors.New("invalid Git URL")
	ErrInvalidOciUrl     = errors.New("invalid OCI artifact reference")
	ErrParseConfigFailed = errors.New("failed to parse config from environment")
)

Functions

func LoadFileBasedEnvVars added in v0.36.0

func LoadFileBasedEnvVars(mappings *[]EnvVarFileMapping) error

LoadFileBasedEnvVars loads env-based config values from file-based env vars if set.

func ParseConfigFromEnv added in v0.36.0

func ParseConfigFromEnv(config any, mappings *[]EnvVarFileMapping) error

ParseConfigFromEnv parses the configuration from environment variables and file-based environment variables.

func ValidateSourceType added in v0.89.0

func ValidateSourceType(source SourceType) error

ValidateSourceType validates source values used by configuration structs.

Types

type EnvVarFileMapping added in v0.36.0

type EnvVarFileMapping struct {
	EnvName    string  // EnvName is the name/key of the environment variable (e.g. API_SECRET)
	EnvValue   *string // EnvValue is the value of the environment variable
	FileValue  *string // FileValue is the content of the file that is specified in the environment variable (e.g. API_SECRET_FILE)
	AllowUnset bool    // AllowUnset indicates if both the fileField and value can be unset
}

EnvVarFileMapping holds the mappings for file-based environment variables.

type GitUrl added in v0.89.0

type GitUrl string

GitUrl is a type for strings that represent Git repository URLs (http, https, ssh, or scp-style).

func (GitUrl) Validate added in v0.89.0

func (g GitUrl) Validate() error

Validate checks whether the GitUrl is a valid Git repository URL.

type HttpUrl added in v0.17.0

type HttpUrl string

HttpUrl is a type for strings that represent plain HTTP or HTTPS URLs (e.g. for API endpoints).

func (HttpUrl) Validate added in v0.89.0

func (h HttpUrl) Validate() error

Validate checks whether the HttpUrl is a valid HTTP or HTTPS URL.

type OciKeylessIdentity added in v0.89.0

type OciKeylessIdentity struct {
	Issuer        string `yaml:"issuer" json:"issuer"`
	Subject       string `yaml:"subject" json:"subject"`
	SubjectRegexp string `yaml:"subject_regexp" json:"subject_regexp"`
}

type OciTrustPolicy added in v0.89.0

type OciTrustPolicy struct {
	Enabled           bool                 `yaml:"enabled" json:"enabled"`
	KeylessIdentities []OciKeylessIdentity `yaml:"keyless_identities" json:"keyless_identities"`
	PublicKeys        []string             `yaml:"public_keys" json:"public_keys"`
}

func EffectiveOciTrustPolicy added in v0.89.0

func EffectiveOciTrustPolicy(global OciTrustPolicy, override OciTrustPolicyOverride) OciTrustPolicy

func NormalizeOciTrustPolicy added in v0.89.0

func NormalizeOciTrustPolicy(p OciTrustPolicy) OciTrustPolicy

type OciTrustPolicyOverride added in v0.89.0

type OciTrustPolicyOverride struct {
	Verify            *bool                `yaml:"verify" json:"verify"`
	KeylessIdentities []OciKeylessIdentity `yaml:"keyless_identities" json:"keyless_identities"`
	PublicKeys        []string             `yaml:"public_keys" json:"public_keys"`
}

type OciUrl added in v0.89.0

type OciUrl string

OciUrl is a type for strings that represent OCI artifact references (e.g. ghcr.io/org/repo:tag).

func (OciUrl) Tag added in v0.89.0

func (o OciUrl) Tag() string

Tag returns the tag portion of the OCI artifact reference (e.g. "main" from "ghcr.io/org/repo:main"). Returns an empty string if the reference cannot be parsed.

func (OciUrl) Validate added in v0.89.0

func (o OciUrl) Validate() error

Validate checks whether the OciUrl is a valid OCI artifact reference.

type SourceType added in v0.89.0

type SourceType string
const (
	SourceTypeGit SourceType = "git"
	SourceTypeOCI SourceType = "oci"

	// OciArtifactLayoutV1 is the strict, versioned OCI artifact layout currently supported by doco-cd.
	OciArtifactLayoutV1 = "doco.v1"
)

func NormalizeSourceType added in v0.89.0

func NormalizeSourceType(source SourceType) SourceType

NormalizeSourceType returns a canonical source type and defaults empty values to git.

type UrlValidator added in v0.89.0

type UrlValidator interface {
	Validate() error
}

UrlValidator is the common interface that both GitUrl and OciUrl implement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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