Document and validate configured secrets bootstrap

This commit is contained in:
2026-11-18 01:10:24 +00:00
parent ab6e610fb7
commit eeafc356e4
13 changed files with 172 additions and 46 deletions

View File

@@ -7,8 +7,8 @@ import (
"go.maximumdirect.net/configkit/internal/engine"
)
// SecretFileStatus describes the outcome for one file considered by
// LoadSecretsIntoEnvironment.
// SecretFileStatus describes the outcome for one file considered by an
// explicit secrets bootstrap helper.
type SecretFileStatus string
const (
@@ -102,8 +102,10 @@ type SecretsOptions struct {
}
// LoadSecretsIntoEnvironmentWithOptions loads immediate regular files into the
// environment using the selected policy. It returns a report even on error;
// applied values are not rolled back. Errors are reported as *SecretsError.
// environment using the selected policy. With Overwrite false it preserves
// existing variables, including empty values. Dot-prefixed entries are ignored.
// It returns a report even on error; applied values are not rolled back.
// Errors are reported as *SecretsError.
func LoadSecretsIntoEnvironmentWithOptions(directory string, options SecretsOptions) (*SecretsReport, error) {
report, err := engine.LoadSecretsDirWithOptions(directory, engine.SecretsDirOptions{Overwrite: options.Overwrite})
return &SecretsReport{value: report}, fromEngineSecretsError(err)
@@ -123,6 +125,7 @@ type SecretsFromConfigOptions struct {
// NoSource and an optional search with no match return NoSource and an empty
// report. The returned source owns a reusable main-document snapshot and its
// host context; imports and environment lookup remain part of each later load.
// A later explicit host context must match the captured root and base.
// At most one options value is accepted. A non-nil report accompanies every
// result. Preparation failures return *LoadError; directory or environment
// failures return *SecretsError. Any error returns a zero Source and does not