Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // A KindError is thrown when you try to pass an invlaid type to `Load` or `Loader.Load` KindError = errors.New("Incorrect config argument. Must be an address to a struct.") // A SessionError gets thrown if you can not create an AWS session successfully SessionError = errors.New("Could not start AWS session.") )
Functions ¶
func Load ¶
Load is a simple utility method, that will instantiate an AWS session for you, and call Loader.Load with a new SSM provider. It's a shortcut, so you don't have to instantiate the session and ssm service yourself.
func RegisterDecodeHook ¶ added in v1.0.2
func RegisterDecodeHook(d DecodeHookFunc)
RegisterDecodeHook allows you to register your own decode hooks for use with your project. Any of the built-in decode hooks in https://github.com/mitchellh/mapstructure can be used here, and we've added StringEnvExpandHookFunc() as a convenience.
Types ¶
type DecodeHookFunc ¶ added in v1.0.2
type DecodeHookFunc mapstructure.DecodeHookFunc
This package takes advantage of the excellent https://github.com/mitchellh/mapstructure library to do most of our conversion. That allows us to take advantage of the decode hooks functionality provided by that library. By default, we always have the mapstructure.StringToTimeDurationHookFunc hook enabled.
func StringEnvExpandHookFunc ¶ added in v1.0.2
func StringEnvExpandHookFunc() DecodeHookFunc
StringEnvExpandHookFunc returns a DecodeHookFunc that expands environment variables embedded in the values. The variables replaced would be in ${var} or $var format. (Parameters of type SecureString will not be expanded.)
type Loader ¶
This is an SSM provider. It allows us to call the AWS parameter store API to retrieve the values stored there.
func (*Loader) Load ¶
Load calls the SSM Parameter Store API, and loads the values stored there into the passed config. It will automatically decrypt encrypted values. config must be a pointer to a struct.
The values are associated with your struct using the `ps` tag.
The prefixPath is the search string used to look up the associated values in the parameter store. For example, passing `/env/application` will find all of the keys and associated values nested under that prefix.