コード例 #1
0
ファイル: config.go プロジェクト: hawson/influxdb
// 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.Monitor = monitor.NewConfig()
	c.Subscriber = subscriber.NewConfig()
	c.HTTPD = httpd.NewConfig()
	c.Collectd = collectd.NewConfig()
	c.OpenTSDB = opentsdb.NewConfig()

	c.ContinuousQuery = continuous_querier.NewConfig()
	c.Retention = retention.NewConfig()
	c.HintedHandoff = hh.NewConfig()
	c.BindAddress = DefaultBindAddress

	// All ARRAY attributes have to be init after toml decode
	// See: https://github.com/BurntSushi/toml/pull/68
	// Those attributes will be initialized in Config.InitTableAttrs method
	// Concerned Attributes:
	//  * `c.Graphites`
	//  * `c.UDPs`

	return c
}
コード例 #2
0
ファイル: config_test.go プロジェクト: hawson/influxdb
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)
	}
}
コード例 #3
0
ファイル: config.go プロジェクト: rwarren/influxdb
// 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.Monitor = monitor.NewConfig()
	c.Subscriber = subscriber.NewConfig()
	c.HTTPD = httpd.NewConfig()
	c.Collectd = collectd.NewConfig()
	c.OpenTSDB = opentsdb.NewConfig()

	c.ContinuousQuery = continuous_querier.NewConfig()
	c.Retention = retention.NewConfig()
	c.HintedHandoff = hh.NewConfig()
	c.BindAddress = DefaultBindAddress

	return c
}