2.5 KiB
ConfigKit v1.3.0
Applications can now bootstrap secrets from a directory declared in a discovered main configuration file, then load that same captured document. Explicit overwrite options support deployments that give provisioned secret files priority over existing environment variables.
Configured secrets startup
Call LoadSecretsIntoEnvironmentFromConfig with a host File or SearchConfig
source. The selected main file can declare:
config:
secrets_dir: secrets
secrets_overwrite: true
The helper resolves the directory relative to the main file's canonical
directory, within its filesystem root, and bootstraps all eligible entries.
It returns a secrets report and a prepared source. Pass that source to Load,
or use it as the main Input.Source for LoadLayered.
The prepared source retains the selected main contents and filesystem context
for reuse. Later loads acquire imports and look up environment values at their
normal lifecycle points. SecretsFromConfigOptions.Filesystem can select a
wider host root during preparation. An explicit context supplied to a later
load must resolve to the captured context. Startup example · Configuration contract
Explicit overwrite policy
Overwrite defaults to false, preserving existing variables including empty
ones. YAML secrets_overwrite: true enables replacement during configured
bootstrap. A non-nil SecretsFromConfigOptions.Overwrite takes precedence over
YAML, including an explicit false.
For an application-supplied directory, use
LoadSecretsIntoEnvironmentWithOptions with SecretsOptions{Overwrite: true}.
Existing LoadSecretsIntoEnvironment(directory) calls retain their preservation
behavior and exact Go function signature.
Bootstrap runs through an explicit helper call before configuration loading.
Reports describe writes, skips, and partial failures without credential contents.
A later configuration failure leaves completed environment writes in place.
Ordinary Load and LoadLayered consume the main controls and resolve typed
secret references from the environment. Bootstrap and failure handling
Consumers require Go 1.27.0 or later.