Exemple #1
0
// DefaultConfig provides a default configuration to create a new command line
// object by best effort.
func DefaultConfig() Config {
	newLogControl, err := logcontrol.NewControl(logcontrol.DefaultControlConfig())
	if err != nil {
		panic(err)
	}

	newTextInterface, err := text.NewClient(text.DefaultClientConfig())
	if err != nil {
		panic(err)
	}

	newConfig := Config{
		// Dependencies.
		Log:               log.New(log.DefaultConfig()),
		LogControl:        newLogControl,
		ServiceCollection: service.MustNewCollection(),
		TextInterface:     newTextInterface,

		// Settings.
		Flags:     Flags{},
		SessionID: string(id.MustNewID()),
		Version:   version,
	}

	return newConfig
}
Exemple #2
0
// DefaultServerConfig provides a default configuration to create a new text
// interface object by best effort.
func DefaultServerConfig() ServerConfig {
	newConfig := ServerConfig{
		Log:               log.New(log.DefaultConfig()),
		ServiceCollection: service.MustNewCollection(),
	}

	return newConfig
}
Exemple #3
0
// DefaultConfig provides a default configuration to create a new CLG object by
// best effort.
func DefaultConfig() Config {
	newConfig := Config{
		// Dependencies.
		ServiceCollection: service.MustNewCollection(),
		Log:               log.New(log.DefaultConfig()),
		StorageCollection: storage.MustNewCollection(),
	}

	return newConfig
}
Exemple #4
0
// DefaultClientConfig provides a default configuration to create a new text
// interface object by best effort.
func DefaultClientConfig() ClientConfig {
	newConfig := ClientConfig{
		// Dependencies.

		ServiceCollection: service.MustNewCollection(),

		// Settings.

		GRPCAddr: "127.0.0.1:9119",
	}

	return newConfig
}
Exemple #5
0
// DefaultConfig provides a default configuration to create a new network
// object by best effort.
func DefaultConfig() Config {
	newConfig := Config{
		// Dependencies.
		Activator:         activator.MustNew(),
		ServiceCollection: service.MustNewCollection(),
		Forwarder:         forwarder.MustNew(),
		Log:               log.New(log.DefaultConfig()),
		StorageCollection: storage.MustNewCollection(),
		Tracker:           tracker.MustNew(),

		// Settings.
		Delay: 0,
	}

	return newConfig
}
Exemple #6
0
// DefaultConfig provides a default configuration to create a new annad object
// by best effort.
func DefaultConfig() Config {
	newServer, err := server.New(server.DefaultConfig())
	if err != nil {
		panic(err)
	}

	newConfig := Config{
		// Dependencies.
		Log:               log.New(log.DefaultConfig()),
		Network:           network.MustNew(),
		Server:            newServer,
		ServiceCollection: service.MustNewCollection(),
		// TODO remove storage collection
		StorageCollection: storage.MustNewCollection(),

		// Settings.
		Flags:   Flags{},
		Version: version,
	}

	return newConfig
}