mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
use strict unmarshalling to ensure correct configuration
This commit is contained in:
parent
1667f1082b
commit
1ec7809eaf
1 changed files with 1 additions and 1 deletions
|
|
@ -25,7 +25,7 @@ func FromFile(filename string) (*MetricsDiscoveryConfig, error) {
|
||||||
// FromYAML loads the configuration from a blob of YAML.
|
// FromYAML loads the configuration from a blob of YAML.
|
||||||
func FromYAML(contents []byte) (*MetricsDiscoveryConfig, error) {
|
func FromYAML(contents []byte) (*MetricsDiscoveryConfig, error) {
|
||||||
var cfg MetricsDiscoveryConfig
|
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 nil, fmt.Errorf("unable to parse metrics discovery config: %v", err)
|
||||||
}
|
}
|
||||||
return &cfg, nil
|
return &cfg, nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue