Documentation ¶
Index ¶
- func Add(s ...ConfigSource) error
- func AddYaml(resources fs.FS) error
- func Extension(name string, value interface{}) error
- func Profile() string
- func Properties(value interface{}) error
- func Property(name string, defaultValue string) string
- func PropertyBool(name string, defaultValue bool) bool
- func PropertyInt(name string, defaultValue int) int
- func SetProfile(profile string)
- type ConfigSource
- type ConfigSourceProvider
- func (c *ConfigSourceProvider) Add(s ...ConfigSource) error
- func (c *ConfigSourceProvider) AddYaml(resources fs.FS) error
- func (c *ConfigSourceProvider) Extension(name string, value interface{}) error
- func (c *ConfigSourceProvider) Profile() string
- func (c *ConfigSourceProvider) Properties(value interface{}) error
- func (c *ConfigSourceProvider) Property(name, defaultValue string) string
- func (c *ConfigSourceProvider) PropertyBool(name string, defaultValue bool) bool
- func (c *ConfigSourceProvider) PropertyInt(name string, defaultValue int) int
- func (c *ConfigSourceProvider) SetProfile(profile string)
- type EnvConfigSource
- type FlagsConfigSource
- type YamlConfigSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add(s ...ConfigSource) error
Add methods add configuration sources to the default provider
func AddYaml ¶
AddYaml adds yaml configuration source for the embedded yaml file to the default provider
func Properties ¶
func Properties(value interface{}) error
Properties setup the properties in the structure base on the tags
func PropertyBool ¶
PropertyBool bool value property from the default configuration source provider
func PropertyInt ¶
PropertyInt int value property from the default configuration source provider
Types ¶
type ConfigSource ¶
type ConfigSource interface { // Init initialize method Init() error // Name of the configuration source Name() string // Priority of the configuration source Priority() int // Properties is the map of all avaiable properties in the configuration source Properties() (map[string]string, error) // Property get property by the name Property(name string) (string, bool, error) }
ConfigSource configuration source interface
type ConfigSourceProvider ¶
type ConfigSourceProvider struct {
// contains filtered or unexported fields
}
ConfigSourceProvider configuration source provider
var ( // Default configuration source provider instance Default *ConfigSourceProvider // ConfigProfileProperty configuration profile property ConfigProfileProperty = "config.profile" )
func (*ConfigSourceProvider) Add ¶
func (c *ConfigSourceProvider) Add(s ...ConfigSource) error
Add methods add configuration sources
func (*ConfigSourceProvider) AddYaml ¶
func (c *ConfigSourceProvider) AddYaml(resources fs.FS) error
AddYaml adds yaml configuration source for the embedded yaml file
func (*ConfigSourceProvider) Extension ¶
func (c *ConfigSourceProvider) Extension(name string, value interface{}) error
Extension setup the properties in the structure base on the tags
func (*ConfigSourceProvider) Profile ¶
func (c *ConfigSourceProvider) Profile() string
Profile configuration profile of the configuration source provider
func (*ConfigSourceProvider) Properties ¶
func (c *ConfigSourceProvider) Properties(value interface{}) error
Properties setup the properties in the structure base on the tags
func (*ConfigSourceProvider) Property ¶
func (c *ConfigSourceProvider) Property(name, defaultValue string) string
Property string value property from the configuration source provider
func (*ConfigSourceProvider) PropertyBool ¶
func (c *ConfigSourceProvider) PropertyBool(name string, defaultValue bool) bool
PropertyBool bool value property from the configuration source provider
func (*ConfigSourceProvider) PropertyInt ¶
func (c *ConfigSourceProvider) PropertyInt(name string, defaultValue int) int
PropertyInt int value property from the configuration source provider
func (*ConfigSourceProvider) SetProfile ¶
func (c *ConfigSourceProvider) SetProfile(profile string)
SetProfile set configuration profile to provider
type EnvConfigSource ¶
type EnvConfigSource struct {
// contains filtered or unexported fields
}
func (*EnvConfigSource) Init ¶
func (f *EnvConfigSource) Init() error
func (*EnvConfigSource) Name ¶
func (f *EnvConfigSource) Name() string
func (*EnvConfigSource) Priority ¶
func (f *EnvConfigSource) Priority() int
func (*EnvConfigSource) Properties ¶
func (f *EnvConfigSource) Properties() (map[string]string, error)
type FlagsConfigSource ¶
type FlagsConfigSource struct {
// contains filtered or unexported fields
}
func (*FlagsConfigSource) Init ¶
func (f *FlagsConfigSource) Init() error
func (*FlagsConfigSource) Name ¶
func (f *FlagsConfigSource) Name() string
func (*FlagsConfigSource) Priority ¶
func (f *FlagsConfigSource) Priority() int
func (*FlagsConfigSource) Properties ¶
func (f *FlagsConfigSource) Properties() (map[string]string, error)
type YamlConfigSource ¶
type YamlConfigSource struct { Prio int // contains filtered or unexported fields }
func (*YamlConfigSource) Init ¶
func (y *YamlConfigSource) Init() error
func (*YamlConfigSource) Name ¶
func (y *YamlConfigSource) Name() string
func (*YamlConfigSource) Priority ¶
func (y *YamlConfigSource) Priority() int
func (*YamlConfigSource) Properties ¶
func (y *YamlConfigSource) Properties() (map[string]string, error)