You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Supported value types: string, int, bool ("carview.php?tsp=true"/"false").
A []byte can be loaded from Base64 encoded string.
Complex type should be either a struct, a map or a slice. You can arbitrarily nest them.
For structs, use global or json tag to set field name.
For maps, the key name is the map key (maps must use strings as keys.)
For slices, all subscripts in Parameter Store must be integers.
Shorthand for running on AWS ECS or Lambda
If you use Global in AWS environments, you can DRY up the code by following a convention:
Set up param prefix in the AWS_PARAM_PREFIX environment variable.
Make sure the IAM role has permissions to the params
Then you can simply use:
varconfigConfig// Will panic if anything goes wrongglobalAWS.MustLoadConfig(&config)
Handling unmapped params
By default, Global assumes that all params from Parameter Store must be mapped to config fields, and returns a warning if some param does not correspond to a config field.
Sometimes, it is expected that the config only contains a subset of the params, and such a warning is unnecessary.
In this case, set options.IgnoreUnmappedParams to true. Note that other mapping issues, like a type mismatch, will still cause an error.
About
Golang configuration reader for AWS Parameter Store and more