Skip to content
Snippets Groups Projects
Unverified Commit 862491ea authored by Cyril Tovena's avatar Cyril Tovena Committed by GitHub
Browse files

fix backward compatibility with client config (#554)

* fix backward compatibility with client config

* fix comment
parent 53075db5
No related branches found
No related tags found
No related merge requests found
......@@ -37,17 +37,24 @@ func (c *Config) RegisterFlags(flags *flag.FlagSet) {
// UnmarshalYAML implement Yaml Unmarshaler
func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
type raw Config
// force sane defaults.
cfg := raw{
BackoffConfig: util.BackoffConfig{
MaxBackoff: 5 * time.Second,
MaxRetries: 5,
MinBackoff: 100 * time.Millisecond,
},
BatchSize: 100 * 1024,
BatchWait: 1 * time.Second,
Timeout: 10 * time.Second,
var cfg raw
if c.URL.URL != nil {
// we used flags to set that value, which already has sane default.
cfg = raw(*c)
} else {
// force sane defaults.
cfg = raw{
BackoffConfig: util.BackoffConfig{
MaxBackoff: 5 * time.Second,
MaxRetries: 5,
MinBackoff: 100 * time.Millisecond,
},
BatchSize: 100 * 1024,
BatchWait: 1 * time.Second,
Timeout: 10 * time.Second,
}
}
if err := unmarshal(&cfg); err != nil {
return err
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment