Commit 931f3eb7 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

helper/config: support outputting metadata

parent faf327ee
......@@ -13,6 +13,9 @@ import (
// DecodeOpts are the options for decoding configuration.
type DecodeOpts struct {
// Metadata, if non-nil, will be set to the metadata post-decode
Metadata *mapstructure.Metadata
// Interpolate, if true, will automatically interpolate the
// configuration with the given InterpolateContext. User variables
// will be automatically detected and added in-place to the given
......@@ -74,6 +77,11 @@ func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error {
}
}
// Set the metadata if it is set
if config.Metadata != nil {
*config.Metadata = md
}
// If we have unused keys, it is an error
if len(md.Unused) > 0 {
var err error
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment