configuration

package
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// HasConfiguration checks to see if the Configuration service contains the service's configuration.
	HasConfiguration() (bool, error)

	// HasSubConfiguration checks to see if the Configuration service contains the service's sub configuration.
	HasSubConfiguration(name string) (bool, error)

	// PutConfigurationToml puts a full toml configuration into the Configuration service
	PutConfigurationToml(configuration *toml.Tree, overwrite bool) error

	// PutConfiguration puts a full configuration struct into the Configuration service
	PutConfiguration(configStruct interface{}, overwrite bool) error

	// GetConfiguration gets the full configuration from Consul into the target configuration struct.
	// Passed in struct is only a reference for Configuration service. Empty struct is fine
	// Returns the configuration in the target struct as interface{}, which caller must cast
	GetConfiguration(configStruct interface{}) (interface{}, error)

	// WatchForChanges sets up a Consul watch for the target key and send back updates on the update channel.
	// Passed in struct is only a reference for Configuration service, empty struct is ok
	// Sends the configuration in the target struct as interface{} on updateChannel, which caller must cast
	WatchForChanges(updateChannel chan<- interface{}, errorChannel chan<- error, configuration interface{}, waitKey string)

	// StopWatching causes all WatchForChanges processing to stop and waits until they have stopped.
	StopWatching()

	// IsAlive simply checks if Configuration service is up and running at the configured URL
	IsAlive() bool

	// ConfigurationValueExists checks if a configuration value exists in the Configuration service
	ConfigurationValueExists(name string) (bool, error)

	// GetConfigurationValue gets a specific configuration value from the Configuration service
	GetConfigurationValue(name string) ([]byte, error)

	// PutConfigurationValue puts a specific configuration value into the Configuration service
	PutConfigurationValue(name string, value []byte) error
}

func NewConfigurationClient

func NewConfigurationClient(config types.ServiceConfig) (Client, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL