Merge pull request #97 from tanner-bruce/strictly-unmarshal

use strict unmarshalling to ensure correct configuration
This commit is contained in:
Solly Ross 2018-08-13 08:53:16 -07:00 committed by GitHub
commit 58857cfd37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,7 @@ func FromFile(filename string) (*MetricsDiscoveryConfig, error) {
// FromYAML loads the configuration from a blob of YAML.
func FromYAML(contents []byte) (*MetricsDiscoveryConfig, error) {
var cfg MetricsDiscoveryConfig
if err := yaml.Unmarshal(contents, &cfg); err != nil {
if err := yaml.UnmarshalStrict(contents, &cfg); err != nil {
return nil, fmt.Errorf("unable to parse metrics discovery config: %v", err)
}
return &cfg, nil