19 lines
756 B
Go
19 lines
756 B
Go
|
|
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},
|
||
|
|
})
|
||
|
|
}
|