config

package
v1.31.9 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 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 added in v1.20.17

func (e *EnvSource) Name() string

type RedisConfigStore added in v1.20.17

type RedisConfigStore struct {
	Pool *radix.Pool
}

func (*RedisConfigStore) GetValue added in v1.20.17

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

func (*RedisConfigStore) Name added in v1.20.17

func (e *RedisConfigStore) Name() string

func (*RedisConfigStore) SaveValue added in v1.20.17

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