Verify configured secrets startup handoff
This commit is contained in:
18
examples/consumers/secrets.go
Normal file
18
examples/consumers/secrets.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package consumers
|
||||
|
||||
import configkit "go.maximumdirect.net/configkit"
|
||||
|
||||
// StartupConfig demonstrates an environment-backed credential and ordinary data.
|
||||
type StartupConfig struct {
|
||||
Name string `yaml:"name"`
|
||||
Token configkit.Secret `yaml:"token"`
|
||||
}
|
||||
|
||||
// PrepareStartup performs the explicit bootstrap once and returns a captured
|
||||
// main that can be passed to either Load or LoadLayered as its main source.
|
||||
// The caller should handle a non-nil report even if preparation fails.
|
||||
func PrepareStartup(main configkit.Source, root string) (*configkit.SecretsReport, configkit.Source, error) {
|
||||
return configkit.LoadSecretsIntoEnvironmentFromConfig(main, configkit.SecretsFromConfigOptions{
|
||||
Filesystem: &configkit.FilesystemContext{Root: root},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user