app/vmagent: do not allow non-supported fields in -remoteWrite.relabelConfig and file_sd_configs

This should reduce possible confusion like in the https://github.com/VictoriaMetrics/VictoriaMetrics/issues/363
This commit is contained in:
Aliaksandr Valialkin 2020-03-06 20:18:28 +02:00
parent 47e986c26f
commit 12789a4621
2 changed files with 2 additions and 2 deletions

View file

@ -28,7 +28,7 @@ func LoadRelabelConfigs(path string) ([]ParsedRelabelConfig, error) {
return nil, fmt.Errorf("cannot read `relabel_configs` from %q: %s", path, err)
}
var rcs []RelabelConfig
if err := yaml.Unmarshal(data, &rcs); err != nil {
if err := yaml.UnmarshalStrict(data, &rcs); err != nil {
return nil, fmt.Errorf("cannot unmarshal `relabel_configs` from %q: %s", path, err)
}
return ParseRelabelConfigs(nil, rcs)

View file

@ -102,7 +102,7 @@ func loadStaticConfigs(path string) ([]StaticConfig, error) {
return nil, fmt.Errorf("cannot read `static_configs` from %q: %s", path, err)
}
var stcs []StaticConfig
if err := yaml.Unmarshal(data, &stcs); err != nil {
if err := yaml.UnmarshalStrict(data, &stcs); err != nil {
return nil, fmt.Errorf("cannot unmarshal `static_configs` from %q: %s", path, err)
}
return stcs, nil