Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Configurator
- type ReConfiguration
- type ReConfigurationComponent
- type ReConfigurationFunc
- type ViperDecorator
- func (v *ViperDecorator) GetFloat32(key string) float32
- func (v *ViperDecorator) GetInt16(key string) int16
- func (v *ViperDecorator) GetInt8(key string) int8
- func (v *ViperDecorator) GetUint16(key string) uint16
- func (v *ViperDecorator) GetUint8(key string) uint8
- func (v *ViperDecorator) ReadConfig() error
Constants ¶
View Source
const ( ConfigPathFieldName = "config.path" ConfigNameFieldName = "config.name" ConfigTypeFieldName = "config.type" ConfigPathDefault = "." ConfigNameDefault = "config" ConfigTypeDefault = "yaml" EnvKeyReplaceFromDefault = "." EnvKeyReplaceToDefault = "_" )
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ closer.OsSignalComponent, }, Constructor: func(container container.Container) error { return container.Provides( NewConfig, New, ) }, BindFlags: func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar(&config.Path, ConfigPathFieldName, ConfigPathDefault, "path to the directory where the config file is located") flagSet.StringVar(&config.Name, ConfigNameFieldName, ConfigNameDefault, "config file name") flagSet.StringVar(&config.Type, ConfigTypeFieldName, ConfigTypeDefault, "config file format") }) }, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Path string Name string Type string EnvKeyReplaceFrom string EnvKeyReplaceTo string }
func Configuration ¶
type Configurator ¶
type Configurator interface { GetString(string) string GetBool(string) bool GetInt(string) int GetInt8(string) int8 GetInt16(string) int16 GetInt32(string) int32 GetInt64(string) int64 GetUint(string) uint GetUint8(string) uint8 GetUint16(string) uint16 GetUint32(string) uint32 GetUint64(string) uint64 GetFloat32(string) float32 GetFloat64(string) float64 GetTime(string) time.Time GetDuration(string) time.Duration GetIntSlice(string) []int GetStringSlice(string) []string GetStringMap(string) map[string]interface{} GetStringMapString(string) map[string]string GetStringMapStringSlice(string) map[string][]string GetSizeInBytes(string) uint SetDefault(string, interface{}) ReadConfig() error }
Configurator : General interface for the application configurator.
func New ¶
func New(config *Config) (Configurator, error)
type ReConfiguration ¶
type ReConfiguration interface {
Registration(components ...ReConfigurationComponent)
}
type ReConfigurationComponent ¶
type ReConfigurationComponent interface {
ReConfiguration(configurator Configurator) error
}
type ReConfigurationFunc ¶
type ReConfigurationFunc func(configurator Configurator) error
func (ReConfigurationFunc) ReConfiguration ¶
func (r ReConfigurationFunc) ReConfiguration(configurator Configurator) error
type ViperDecorator ¶
func NewViperDecorator ¶
func NewViperDecorator(config *Config) (*ViperDecorator, error)
func NewViperDecoratorWithConfiguration ¶
func NewViperDecoratorWithConfiguration(config *Config) (*ViperDecorator, error)
func (*ViperDecorator) GetFloat32 ¶
func (v *ViperDecorator) GetFloat32(key string) float32
func (*ViperDecorator) GetInt16 ¶
func (v *ViperDecorator) GetInt16(key string) int16
func (*ViperDecorator) GetInt8 ¶
func (v *ViperDecorator) GetInt8(key string) int8
func (*ViperDecorator) GetUint16 ¶
func (v *ViperDecorator) GetUint16(key string) uint16
func (*ViperDecorator) GetUint8 ¶
func (v *ViperDecorator) GetUint8(key string) uint8
func (*ViperDecorator) ReadConfig ¶
func (v *ViperDecorator) ReadConfig() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.