config

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Singleton = NewConfigManager()

Functions

func AddSource

func AddSource(source ConfigSource)

func Load

func Load()

Types

type ConfigManager

type ConfigManager struct {
	Options map[string]*ConfigOption
	// contains filtered or unexported fields
}

func NewConfigManager

func NewConfigManager() *ConfigManager

func (*ConfigManager) AddSource

func (c *ConfigManager) AddSource(source ConfigSource)

func (*ConfigManager) Load

func (c *ConfigManager) Load()

func (*ConfigManager) RegisterOption

func (c *ConfigManager) RegisterOption(name, desc string, defaultValue interface{}) *ConfigOption

type ConfigOption

type ConfigOption struct {
	Name         string
	Description  string
	DefaultValue interface{}
	LoadedValue  interface{}
	Manager      *ConfigManager
}

func RegisterOption

func RegisterOption(name, desc string, defaultValue interface{}) *ConfigOption

func (*ConfigOption) GetBool

func (opt *ConfigOption) GetBool() bool

func (*ConfigOption) GetInt

func (opt *ConfigOption) GetInt() int

func (*ConfigOption) GetString

func (opt *ConfigOption) GetString() string

func (*ConfigOption) LoadValue

func (opt *ConfigOption) LoadValue()

type ConfigSource

type ConfigSource interface {
	GetValue(key string) interface{}
}

type EnvSource

type EnvSource struct{}

func (*EnvSource) GetValue

func (e *EnvSource) GetValue(key string) interface{}

type Stringer

type Stringer interface {
	String() string
}

Jump to

Keyboard shortcuts

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