config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 NewField

func NewField(fld *reflect.StructField, val *reflect.Value) (*Field, error)

NewField constructor.

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) 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"
)

Jump to

Keyboard shortcuts

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