Exemplo n.º 1
0
// DefaultConfig provides a default configuration to create a new server object
// by best effort.
func DefaultConfig() Config {
	newInstrumentation, err := memory.NewInstrumentation(memory.DefaultInstrumentationConfig())
	if err != nil {
		panic(err)
	}

	newLogControl, err := logcontrol.NewControl(logcontrol.DefaultControlConfig())
	if err != nil {
		panic(err)
	}

	newTextInterface, err := text.NewServer(text.DefaultServerConfig())
	if err != nil {
		panic(err)
	}

	newConfig := Config{
		// Dependencies.

		Instrumentation: newInstrumentation,
		Log:             log.New(log.DefaultConfig()),
		LogControl:      newLogControl,
		TextInterface:   newTextInterface,

		// Settings.

		GRPCAddr: "127.0.0.1:9119",
		HTTPAddr: "127.0.0.1:9120",
	}

	return newConfig
}
Exemplo n.º 2
0
// DefaultStorageConfig provides a default configuration to create a new redis
// storage object by best effort.
func DefaultStorageConfig() StorageConfig {
	newInstrumentation, err := memory.NewInstrumentation(memory.DefaultInstrumentationConfig())
	if err != nil {
		panic(err)
	}

	newStorageConfig := StorageConfig{
		// Dependencies.
		Instrumentation: newInstrumentation,
		Log:             log.New(log.DefaultConfig()),
		Pool:            NewPool(DefaultPoolConfig()),

		// Settings.
		BackoffFactory: func() spec.Backoff {
			return &backoff.StopBackOff{}
		},
		Prefix: "prefix",
	}

	return newStorageConfig
}