Documentation
¶
Index ¶
- Variables
- func LoadFileBasedEnvVars(mappings *[]EnvVarFileMapping) error
- func ParseConfigFromEnv(config any, mappings *[]EnvVarFileMapping) error
- func ValidateSourceType(source SourceType) error
- type EnvVarFileMapping
- type GitUrl
- type HttpUrl
- type OciKeylessIdentity
- type OciTrustPolicy
- type OciTrustPolicyOverride
- type OciUrl
- type SourceType
- type UrlValidator
Constants ¶
This section is empty.
Variables ¶
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).
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).
type OciKeylessIdentity ¶ added in v0.89.0
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).
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.