settings package - codefloe.com/crowci/crow/v6/pipeline/frontend/yaml/compiler/settings - Go Packages

settings

package
v6.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectExternalSecrets

func InjectExternalSecrets(v any, fetched *FetchedExternalSecrets) (any, error)

InjectExternalSecrets replaces external secret references (from_secret with object value) with the actual fetched secret values.

func ParamsToEnv

func ParamsToEnv(from map[string]any, to map[string]string, prefix string, upper bool, getSecretValue func(name string) (string, error), secretMapping map[string]string) (err error)

ParamsToEnv uses reflection to convert a map[string]interface to a list of environment variables.

Types

type CollectedExternalSecrets

type CollectedExternalSecrets struct {
	// Refs are all unique external secret references found
	Refs []ExternalSecretRef
	// RefsByKey maps a unique key to the reference for deduplication
	RefsByKey map[string]ExternalSecretRef
}

CollectedExternalSecrets holds the result of scanning YAML for external secrets.

func CollectExternalSecrets

func CollectExternalSecrets(v any) *CollectedExternalSecrets

CollectExternalSecrets scans a value (typically YAML settings/environment) for external secret references (from_secret with object value) and collects them for batch fetching. Note: from_secret with a string value is an internal secret, handled separately.

func (*CollectedExternalSecrets) HasExternalSecrets

func (c *CollectedExternalSecrets) HasExternalSecrets() bool

HasExternalSecrets checks if the collected secrets contain any references.

type ExternalSecretBatchFetcher

type ExternalSecretBatchFetcher func(ctx context.Context, refs []ExternalSecretRef) (map[ExternalSecretRef]string, error)

ExternalSecretBatchFetcher fetches a batch of external secrets in a single call. The returned map MUST contain an entry for every input ref on success; implementations should group by integration to share authentication and minimize round-trips.

type ExternalSecretFetcher

type ExternalSecretFetcher func(ctx context.Context, ref ExternalSecretRef) (string, error)

ExternalSecretFetcher is a function that fetches a single secret from an external store. Kept for callers (e.g., tests) that fetch one secret at a time. Production callers should prefer ExternalSecretBatchFetcher, which only authenticates against each integration once.

type ExternalSecretRef

type ExternalSecretRef struct {
	IntegrationID   int64  // Numeric ID (used if IntegrationName is empty)
	IntegrationName string // Name lookup (takes precedence if set)
	Path            string
	Key             string
	Version         int
}

ExternalSecretRef represents a reference to an external secret store.

type FetchedExternalSecrets

type FetchedExternalSecrets struct {
	// Secrets maps the unique key to the fetched secret value
	Secrets map[string]string
}

FetchedExternalSecrets holds secrets that have been fetched from external stores.

func FetchExternalSecrets

func FetchExternalSecrets(ctx context.Context, collected *CollectedExternalSecrets, fetcher ExternalSecretBatchFetcher) (*FetchedExternalSecrets, error)

FetchExternalSecrets fetches all collected external secrets using the provided batch fetcher. Returns a map that can be used to resolve references during YAML processing. A single batch call lets the fetcher authenticate against each integration only once, which avoids per-secret HTTP overhead when a workflow references many external secrets.

type SecretFetchers

type SecretFetchers struct {
	// GetInternalSecret fetches secrets from Crow's internal secret store
	GetInternalSecret func(name string) (string, error)
	// GetExternalSecret fetches secrets from external stores (Vault, etc.)
	GetExternalSecret ExternalSecretFetcher
	// Context for external secret operations
	Ctx context.Context
}

SecretFetchers holds callbacks for fetching secrets from various sources.

Jump to

Keyboard shortcuts

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