From 435fc7234fe01ee53b19aa1baeef067964715163 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Tue, 14 Jul 2015 02:46:00 +0200 Subject: [PATCH] config: add overflow detection for serverset config --- config/config.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 281435ce5..888d5d628 100644 --- a/config/config.go +++ b/config/config.go @@ -428,6 +428,9 @@ type ServersetSDConfig struct { Servers []string `yaml:"servers"` Paths []string `yaml:"paths"` Timeout Duration `yaml:"timeout,omitempty"` + + // Catches all undefined fields and must be empty after parsing. + XXX map[string]interface{} `yaml:",inline"` } // UnmarshalYAML implements the yaml.Unmarshaler interface. @@ -449,7 +452,7 @@ func (c *ServersetSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) err return fmt.Errorf("serverset SD config paths must begin with '/': %s", path) } } - return nil + return checkOverflow(c.XXX, "serverset_sd_config") } // RelabelAction is the action to be performed on relabeling.