config

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Getter

type Getter interface {
	Get(key string) interface{}
	GetString(key string) string
	GetBool(key string) bool
	GetInt(key string) int
	IsSet(key string) bool
	UnmarshalKey(key string, target interface{}) error
}

Getter allows to get configuration options inside pluggable components.

func NewViperConfigGetter

func NewViperConfigGetter(v *viper.Viper) Getter

NewViperConfigGetter is a wrapper over viper to return ConfigGetter interface from it.

type Reloader

type Reloader interface {
	Reload(Getter) error
}

Reloader interface must be implemented by entities supporing configuration reload.

type Setter

type Setter interface {
	SetDefault(key string, value interface{})
	BindEnv(key string)
	BindFlag(key string, flagName string)
	StringFlag(name, shorthand string, value string, usage string)
	BoolFlag(name, shorthand string, value bool, usage string)
	IntFlag(name, shorthand string, value int, usage string)
}

Setter allows to setup configuration options from pluggable components.

func NewViperConfigSetter

func NewViperConfigSetter(v *viper.Viper, fs *pflag.FlagSet) Setter

NewViperConfigSetter is a wrapper over viper to return ConfigSetter interface from it.

type Validator

type Validator interface {
	Validate(Getter) error
}

Validator interface must be implemented by entities supporing configuration validation.

Jump to

Keyboard shortcuts

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