configuration

package
v0.0.0-...-16cb735 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(config *Configuration) []error

Validate a configuration

Types

type Configuration

type Configuration struct {
	// Name is the unique name of the node
	Name string `koanf:"name"`
	// Bind is the address and port used for cluster communication
	Bind string `koanf:"bind"`
	// Peers is a list of peers' bind addresses and ports
	Peers []string `koanf:"peers"`
	// Services contains all the configured services, mapped by their name
	Services []*ServiceConfiguration `koanf:"services"`
	// Api contains configuration for the REST API
	Api struct {
		// Enabled controls whether or not the REST API is enabled
		Enabled bool `koanf:"enabled"`
		// Bind is the address and port used for cluster communication
		Bind string `koanf:"bind"`
	} `koanf:"api"`
}

Configuration of the service

func Load

func Load(filePath string) (*Configuration, error)

Load a configuration from a YAML file

func (*Configuration) MemberlistConfig

func (config *Configuration) MemberlistConfig() (*memberlist.Config, error)

MemberlistConfig creates a configuration for the memberlist gossip library

type MonitorConfiguration

type MonitorConfiguration struct {
	// Id is an identifier of the monitor, unique for the service
	Id string `koanf:"id"`
	// Type is the type of monitor, such as "ping" or "http"
	Type string `koanf:"type"`
	// Name is a name of the monitor
	Name string `koanf:"name"`
	// Description describes the monitor
	Description string `koanf:"description"`
	// Options contains arbitrary fields to use when configuring the monitor
	Options map[string]interface{} `koanf:"options"`
}

MonitorConfiguration configures a monitor for a service

type ServiceConfiguration

type ServiceConfiguration struct {
	// Id is an identifier for the service, unique for all services
	Id string `koanf:"id"`
	// Name is the name of the service
	Name string `koanf:"name"`
	// Description is a description of the service
	Description string `koanf:"description"`
	// Monitors is a list of monitors to use to monitor the service
	Monitors []*MonitorConfiguration `koanf:"monitors"`
	// Private indicates whether or not the service configuration is shared with the cluster
	Private bool `koan:"private"`
	// Origin is the node from which this service is configured
	Origin string
}

ServiceConfiguration configures a service to be monitored

Jump to

Keyboard shortcuts

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