config

package
v1.31.14 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 5 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

	ConfigSource ConfigSource
}

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{}
	Name() string
}

type EnvSource

type EnvSource struct{}

func (*EnvSource) GetValue

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

func (*EnvSource) Name

func (e *EnvSource) Name() string

type RedisConfigStore

type RedisConfigStore struct {
	Pool *radix.Pool
}

func (*RedisConfigStore) GetValue

func (rs *RedisConfigStore) GetValue(key string) interface{}

func (*RedisConfigStore) Name

func (e *RedisConfigStore) Name() string

func (*RedisConfigStore) SaveValue

func (rs *RedisConfigStore) SaveValue(key, value string) error

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