config: check overflow in global section

This commit is contained in:
Fabian Reinartz 2016-09-05 11:30:07 +02:00
parent 44bde96447
commit c01c1989a7
1 changed files with 7 additions and 1 deletions

View File

@ -297,13 +297,19 @@ type GlobalConfig struct {
HipchatAuthToken Secret `yaml:"hipchat_auth_token"` HipchatAuthToken Secret `yaml:"hipchat_auth_token"`
OpsGenieAPIHost string `yaml:"opsgenie_api_host"` OpsGenieAPIHost string `yaml:"opsgenie_api_host"`
VictorOpsAPIURL string `yaml:"victorops_api_url"` VictorOpsAPIURL string `yaml:"victorops_api_url"`
// Catches all undefined fields and must be empty after parsing.
XXX map[string]interface{} `yaml:",inline"`
} }
// UnmarshalYAML implements the yaml.Unmarshaler interface. // UnmarshalYAML implements the yaml.Unmarshaler interface.
func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
*c = DefaultGlobalConfig *c = DefaultGlobalConfig
type plain GlobalConfig type plain GlobalConfig
return unmarshal((*plain)(c)) if err := unmarshal((*plain)(c)); err != nil {
return err
}
return checkOverflow(c.XXX, "global")
} }
// A Route is a node that contains definitions of how to handle alerts. // A Route is a node that contains definitions of how to handle alerts.