// NewConfig returns the default config with temporary paths.
func NewConfig() *server.Config {
	c := server.NewConfig()
	c.Reporting.Enabled = false
	c.Replay.Dir = MustTempDir()
	c.Storage.BoltDBPath = filepath.Join(MustTempDir(), "bolt.db")
	c.DataDir = MustTempDir()
	c.HTTP.BindAddress = "127.0.0.1:0"
	//c.HTTP.BindAddress = "127.0.0.1:9092"
	//c.HTTP.GZIP = false
	c.InfluxDB[0].Enabled = false
	return c
}
示例#2
0
// NewConfig returns the default config with temporary paths.
func NewConfig() *server.Config {
	c := server.NewConfig()
	c.PostInit()
	c.Reporting.Enabled = false
	c.Replay.Dir = MustTempFile()
	c.Storage.BoltDBPath = MustTempFile()
	c.DataDir = MustTempFile()
	c.HTTP.BindAddress = "127.0.0.1:0"
	//c.HTTP.BindAddress = "127.0.0.1:9092"
	//c.HTTP.GZIP = false
	c.InfluxDB[0].Enabled = false
	return c
}
示例#3
0
// ParseConfig parses the config at path.
// Returns a demo configuration if path is blank.
func (cmd *Command) ParseConfig(path string) (*server.Config, error) {
	// Use demo configuration if no config path is specified.
	if path == "" {
		log.Println("No configuration provided, using default settings")
		return server.NewDemoConfig()
	}

	log.Println("Using configuration at:", path)

	config := server.NewConfig()
	if _, err := toml.DecodeFile(path, &config); err != nil {
		return nil, err
	}

	return config, nil
}
示例#4
0
// ParseConfig parses the config at path.
// Returns a demo configuration if path is blank.
func (cmd *PrintConfigCommand) parseConfig(path string) (*server.Config, error) {
	config, err := server.NewDemoConfig()
	if err != nil {
		config = server.NewConfig()
	}

	if path == "" {
		return config, nil
	}

	log.Println("Merging with configuration at:", path)
	if _, err := toml.DecodeFile(path, &config); err != nil {
		return nil, err
	}
	return config, nil
}