config

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CfgType added in v0.6.0

type CfgType interface {
	fmt.Stringer
	SetString(string) error
}

CfgType represents an interface which any config field type must implement.

type Config

type Config struct {
	Fields []*Field
}

Config manages configuration and handles updates on the values.

func New

func New(cfg interface{}) (*Config, error)

New creates a new monitor.

type Field

type Field struct {
	// contains filtered or unexported fields
}

Field definition of a config value that can change.

func (*Field) Name

func (f *Field) Name() string

Name getter.

func (*Field) Set

func (f *Field) Set(value string, version uint64) error

Set the value of the field.

func (*Field) Sources

func (f *Field) Sources() map[Source]string

Sources getter.

func (*Field) String added in v0.4.0

func (f *Field) String() string

String returns string representation of field's value.

func (*Field) Type

func (f *Field) Type() string

Type getter.

type Source

type Source string

Source definition.

const (
	// SourceSeed defines a seed value.
	SourceSeed Source = "seed"
	// SourceEnv defines a value from environment variables.
	SourceEnv Source = "env"
	// SourceConsul defines a value from consul.
	SourceConsul Source = "consul"
	// SourceFlag defines a value from CLI flag.
	SourceFlag Source = "flag"
	// SourceFile defines a value from external file.
	SourceFile Source = "file"
)

Jump to

Keyboard shortcuts

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