func TestDefaultDisabled(t *testing.T) { // Parse empty configuration. var c hh.Config if _, err := toml.Decode(``, &c); err != nil { t.Fatal(err) } if exp := false; c.Enabled == true { t.Fatalf("unexpected default Enabled value: got %v, exp %v", c.Enabled, exp) } // Default configuration. c = hh.NewConfig() if exp := false; c.Enabled == true { t.Fatalf("unexpected default enabled value: got %v, exp %v", c.Enabled, exp) } }
// NewConfig returns an instance of Config with reasonable defaults. func NewConfig() *Config { c := &Config{} c.Meta = meta.NewConfig() c.Data = tsdb.NewConfig() c.Cluster = cluster.NewConfig() c.Precreator = precreator.NewConfig() c.Admin = admin.NewConfig() c.HTTPD = httpd.NewConfig() c.Collectd = collectd.NewConfig() c.OpenTSDB = opentsdb.NewConfig() c.Monitoring = monitor.NewConfig() c.ContinuousQuery = continuous_querier.NewConfig() c.Retention = retention.NewConfig() c.HintedHandoff = hh.NewConfig() return c }
// NewConfig returns an instance of Config with reasonable defaults. func NewConfig() *Config { c := &Config{} c.Meta = meta.NewConfig() c.Data = tsdb.NewConfig() c.Cluster = cluster.NewConfig() c.Registration = registration.NewConfig() c.Precreator = precreator.NewConfig() c.Admin = admin.NewConfig() c.Monitor = monitor.NewConfig() c.Subscriber = subscriber.NewConfig() c.HTTPD = httpd.NewConfig() c.Graphites = []graphite.Config{graphite.NewConfig()} c.Collectd = collectd.NewConfig() c.OpenTSDB = opentsdb.NewConfig() c.UDPs = []udp.Config{udp.NewConfig()} c.ContinuousQuery = continuous_querier.NewConfig() c.Retention = retention.NewConfig() c.HintedHandoff = hh.NewConfig() return c }