Documentation
¶
Overview ¶
Package configparser defines some default configs handler including a configparser parser with ability to update value dynamically
Index ¶
Constants ¶
View Source
const OptionsRegex string = "^(([\\w\\.])+(\\.)([\\w]){2,4}([\\w]*))*$"
Variables ¶
View Source
var ( ErrEmptyValue = fmt.Errorf("empty strings") ErrInvalidFormat = fmt.Errorf("invalid format") ErrInvalidOptionsMatch = fmt.Errorf("invalid options match") )
View Source
var Standalone = NewConfigManager()
Standalone is a singleton config manager that acts as a general manager for iris.
View Source
var TestParser = NewConfigManager()
TestParser acts as a test config manager that can be used globally.
Functions ¶
Types ¶
type ConfigManager ¶
ConfigManager holds types for generic managers to generate configs.
func NewConfigManager ¶
func NewConfigManager() *ConfigManager
NewConfigManager makes a configs manager.
func (*ConfigManager) AddSource ¶
func (c *ConfigManager) AddSource(source Source)
AddSource allows users to append given configparser source to the manager.
func (*ConfigManager) Load ¶
func (c *ConfigManager) Load()
Load handles configs func LoadValue directly.
type EnvSource ¶
type EnvSource struct{}
type Options ¶
type Options struct { // Name will have format iris.option1.option2 Name string Description string DefaultValue interface{} LoadedValue interface{} Manager *ConfigManager ConfigSource Source }
func (*Options) LoadValue ¶
func (opt *Options) LoadValue()
LoadValue will load given values if exists, otherwise use default ones.
func (*Options) UpdateValue ¶
func (opt *Options) UpdateValue(val interface{})
UpdateValue updates loaded value.
Click to show internal directories.
Click to hide internal directories.